Comments (4)
Please provide more details.
XDK version, Cordova version, platform (android / ios ), emulator or device, etc.
Did you check the OS logs? Any exception?
Did you try any other cordova plugin? If yes, did it work?
from cordova-plugin-sim.
It works for me.
I used Intel XDK
and Intel App Preview
app on my Android phone.
I got the expected result.
from cordova-plugin-sim.
I also use XDK and intel app preview on my android, but it does not work. Can you give some examples?
thanks
from cordova-plugin-sim.
I extended default init-app.js
/*
* Please see the included README.md file for license terms and conditions.
*/
// This file is a suggested initialization place for your code.
// It is completely optional and not required.
// It implements a Cordova "hide splashscreen" function, that may be useful.
// Note the reference that includes it in the index.html file.
/*jslint browser:true, devel:true, white:true, vars:true */
/*global $:false, intel:false, app:false, dev:false */
/*global myEventHandler:false, cordova:false, device:false */
window.app = window.app || {} ; // there should only be one of these...
// Set to "true" if you want the console.log messages to appear.
app.LOG = app.LOG || false ;
app.consoleLog = function() { // only emits console.log messages if app.LOG != false
if( app.LOG ) {
var args = Array.prototype.slice.call(arguments, 0) ;
console.log.apply(console, args) ;
}
} ;
// App init point (runs on custom app.Ready event from init-dev.js).
// Runs after underlying device native code and webview/browser is ready.
// Where you should "kick off" your application by initializing app events, etc.
// NOTE: Customize this function to initialize your application, as needed.
app.initEvents = function() {
"use strict" ;
var fName = "app.initEvents():" ;
app.consoleLog(fName, "entry") ;
// NOTE: initialize your third-party libraries and event handlers
// initThirdPartyLibraryNumberOne() ;
// initThirdPartyLibraryNumberTwo() ;
// initThirdPartyLibraryNumberEtc() ;
// NOTE: initialize your application code
// initMyAppCodeNumberOne() ;
// initMyAppCodeNumberTwo() ;
// initMyAppCodeNumberEtc() ;
// NOTE: initialize your app event handlers, see app.js for a simple event handler example
// TODO: configure following to work with both touch and click events (mouse + touch)
// see http://msopentech.com/blog/2013/09/16/add-pinch-pointer-events-apache-cordova-phonegap-app/
var el, evt ;
if( navigator.msPointerEnabled || !('ontouchend' in window)) // if on Win 8 machine or no touch
evt = "click" ; // let touch become a click event
else // else, assume touch events available
evt = "touchend" ; // not optimum, but works
el = document.getElementById("id_btnHello") ;
el.addEventListener(evt, myEventHandler, false) ;
// NOTE: ...you can put other miscellaneous init stuff in this function...
// NOTE: ...and add whatever else you want to do now that the app has started...
// NOTE: ...or create your own init handlers outside of this file that trigger off the "app.Ready" event...
app.initDebug() ; // just for debug, not required; keep it if you want it or get rid of it
app.hideSplashScreen() ; // after init is good time to remove splash screen; using a splash screen is optional
// app initialization is done
// app event handlers are ready
// exit to idle state and wait for app events...
app.consoleLog(fName, "exit") ;
window.plugins.sim.getSimInfo(successCallback, errorCallback);
} ;
document.addEventListener("app.Ready", app.initEvents, false) ;
function successCallback(result) {
app.consoleLog("sim success", result) ;
console.log("sim success");
console.log(JSON.stringify(result));
}
function errorCallback(error) {
app.consoleLog("sim error", error) ;
console.log("sim error");
console.log(JSON.stringify(error));
}
// Just a bunch of useful debug console.log() messages.
// Runs after underlying device native code and webview/browser is ready.
// The following is just for debug, not required; keep it if you want or get rid of it.
app.initDebug = function() {
"use strict" ;
var fName = "app.initDebug():" ;
app.consoleLog(fName, "entry") ;
if( window.device && device.cordova ) { // old Cordova 2.x version detection
app.consoleLog("device.version: " + device.cordova) ; // print the cordova version string...
app.consoleLog("device.model: " + device.model) ;
app.consoleLog("device.platform: " + device.platform) ;
app.consoleLog("device.version: " + device.version) ;
}
if( window.cordova && cordova.version ) { // only works in Cordova 3.x
app.consoleLog("cordova.version: " + cordova.version) ; // print new Cordova 3.x version string...
if( cordova.require ) { // print included cordova plugins
app.consoleLog(JSON.stringify(cordova.require('cordova/plugin_list').metadata, null, 1)) ;
}
}
app.consoleLog(fName, "exit") ;
} ;
// Using a splash screen is optional. This function will not fail if none is present.
// This is also a simple study in the art of multi-platform device API detection.
app.hideSplashScreen = function() {
"use strict" ;
var fName = "app.hideSplashScreen():" ;
app.consoleLog(fName, "entry") ;
// see https://github.com/01org/appframework/blob/master/documentation/detail/%24.ui.launch.md
// Do the following if you disabled App Framework autolaunch (in index.html, for example)
// $.ui.launch() ;
if( navigator.splashscreen && navigator.splashscreen.hide ) { // Cordova API detected
navigator.splashscreen.hide() ;
}
if( window.intel && intel.xdk && intel.xdk.device ) { // Intel XDK device API detected, but...
if( intel.xdk.device.hideSplashScreen ) // ...hideSplashScreen() is inside the base plugin
intel.xdk.device.hideSplashScreen() ;
}
app.consoleLog(fName, "exit") ;
} ;
from cordova-plugin-sim.
Related Issues (20)
- Note: iOS 16.4 depreciation CTCarrier (does not work after)
- Get Undefined
- Support for Android Permission Rationale Description?
- Support for Windows UWP planned?
- phonenumber is getting nulll HOT 2
- Judge whether there is a SIM card? HOT 1
- Cordova Not Available when getting SIM info HOT 2
- Dual sim IMEI
- in iPhone is required to include a permission on config.xml? HOT 1
- plugin not working, reported not installed under iOS
- ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function TypeError: Object(...) is not a function at Sim.getSimInfo HOT 1
- ionic native sim plugin iOS side not working HOT 1
- app can't access imei in android 10. HOT 4
- Phone Number returns empty string HOT 2
- unable to fetch IMEI number on android 10 HOT 5
- Plugin not working on iOS
- The user 10412 does not meet the requirements to access device identifiers. HOT 5
- Empty phoneNumber string HOT 1
- Error when trying to get sim info on new Android device HOT 1
- This plugin has a maintained repo now - please use and follow
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-sim.