- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hai sir,
I am new in Intel XDK. I develop a new app for my company using IntelXDK. In my App i am checking, whether the internet connection is established or not in the device, and there is no internet connection, then exit the app.
Code :
document.addEventListener("intel.xdk.device.ready", onDeviceReady, false);
function onDeviceReady(){
var networkState = navigator.connection.type;
var states = {};
states[Connection.UNKNOWN] = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI] = 'WiFi connection';
states[Connection.CELL_2G] = 'Cell 2G connection';
states[Connection.CELL_3G] = 'Cell 3G connection';
states[Connection.CELL_4G] = 'Cell 4G connection';
states[Connection.CELL] = 'Cell generic connection';
states[Connection.NONE] = 'No network connection';
if ((states[networkState]) == states[Connection.NONE]) {
alert('No Internet Connection. Click OK to exit app');
navigator.app.exitApp();
}
}
The code working fine with IntelXDK App Preview and i convert it into apk using intel XDK Build, its not working....
I enable all the plugins in Cordova Hybrid Mobile App Settings.
- Tags:
- HTML5
- Intel® XDK
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are using intel.xdk.device.ready event, so you need to enable Intel XDK device plugin (on the right side of plugins section).
If you are already doing that send your complete project zip file.
Swati
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Make sure you have your permissions set. This same issue happened to me. Go to the Projects Tab, Select Build Settings, and then set the Domain List to "*" (without the quotes). Then do a build and try it out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have the same problem.
Intel XDK emulation works OK. I have installed Intel XDK Device and Network Information plugin. But using my device does not work
Tranks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As Adam mentioned make sure you choose proper whitelisting. See this article if you are not sure how to set.https://software.intel.com/en-us/articles/cordova-whitelisting-with-intel-xdk-for-ajax-and-launching-external-apps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thanks for the reply.
I'm not sure to have intel XDK properly configured.
I attached a picture with my intel XDK app permissions configuration.
The plugins to this projects are:
Status bar.
Device.
Splashscreen.
NetworkInformation.
IntelXDKDevice.
InAppBrowser.
Thanks for the help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Choose the W3C option for Android and set the "Network Requests" field to * to get started. Then you can make it more explicit once you have your app working and you know the specific domains you will be using.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The external connection works, but I want to show an error when the smartphone is not connected to the Internet.
It works on the emulator, but not on the phone.
Permissions problem?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I found the problem.
Using the Cordova notification plugin works.
I think the intel alert plugin have problems.
Thanks for all and sorry for my English
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have tried all the given solutions but emulator was fine while the device had nothing. By chance the code below worked. I added it here if someone needs. // Wait for device API libraries to load // document.addEventListener("deviceready", onDeviceReady, false); // device APIs are available // function onDeviceReady() { checkConnection(); } function checkConnection() { var networkState = navigator.connection.type; var states = {}; states[Connection.UNKNOWN] = 'Unknown connection'; states[Connection.ETHERNET] = 'Ethernet connection'; states[Connection.WIFI] = 'WiFi connection'; states[Connection.CELL_2G] = 'Cell 2G connection'; states[Connection.CELL_3G] = 'Cell 3G connection'; states[Connection.CELL_4G] = 'Cell 4G connection'; states[Connection.CELL] = 'Cell generic connection'; states[Connection.NONE] = 'No network connection'; if ((states[networkState]) == states[Connection.NONE]) { alert('Uygulamayı Kullanman İçin İnternet Bağlantısı Gerekmektedir. Lütfen Bir Ağa Bağlan .'); navigator.app.exitApp(); } }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel XDK plugins have been deprecated, they are available on github but are not maintained. Intel XDK is standardizing on Cordova plugin, so we recommend that you use Cordova plugins and deviceready events (not intel.xdk.device.ready event). As Vincent mentioned, use Cordova Navigator object to get connection and other device properties. For the navigator plugin to work to get connection property you do not need to set any whitelisting. You just need to add the Network Information plugin under the Cordova Plugins in the Plugins Management section.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page