on 07-12-2013 12:38 PM
HI,
How can we check for the network status in SUP hybrid app.
I am aware of achieving through registering listeners but i want to know the network status when my app is launched.
Thanks,
Ankit
The HWC based hybrid apps are developed using HTML, JavaScript and CSS. So you have to write javascript code to to check the availablity of internet.
In the custom.js file inside the generated WF you can find methods like customBeforeWorkflowLoad()and customAfterWorkflowLoad(). These methods will be first called once you run the app from the device. So you have to write the code inside of these functions ( any one ) to check the availability of the internet.
Try using these example code:
var online = window.navigator.onLine;
if (!online) {
alert('Please check your internet connection and try again.');
}
function checkInternet() {
var online = window.navigator.onLine;
if (!online) {
alert('Please check your internet connection and try again.');
}
}
The code above I have taken from internet but didn't try it. You may have to modify it to make it working. If I get a chance to try the code I will try and update.
- Midhun VP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.