02-14-2012 08:03 PM
I am trying to create a form that will email me through my app, however, I only want to show it if the user is connected to wifi...
<script type="text/javascript">
var myJSONObject = {
"data":{
"hasCapability":[
"network.wlan"
],
}
}
// Check if we have GPS capability
if (blackberry.system.hasCapability("network.wlan")) {
document.write('YOU ARE ON WIFI');
}
else {
document.write('YOU ARE NOT ON WIFI')
}
</script>This is what I have right now.
This is my XML:
<?xml version="1.0" encoding="utf-8"?> <widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="999.999.999"> <name>Test</name> <authorId>bbthemelab</authorId> <author>bbthemelab</author> <autoOrients>false</autoOrients> <feature id="blackberry.system" /> <rim:orientation mode="landscape" /> <icon rim:hover="false" src="appicon.png"/> <content src="index.html"/> </widget>
So, the apps kinda works. When I load it on my playbook, it reads YOU ARE ON WIFI. However, when I flip the switch on my wifi, it continues to read YOU ARE ON WIFI. I also tried to close the app and reload it, and it continue to reads YOU ARE ON WIFI.
Any help would be greatly appreciated!
Solved! Go to Solution.
02-14-2012 08:20 PM
I should learn to keep trying and trying before I go ahead and come on here...
<script type="text/javascript">
var WiFiConnection = {
"data":{
"hasDataCoverage":true,
}
}
// Are we connected to Wifi?
if (blackberry.system.hasDataCoverage()) {
document.write('YOU ARE ON WIFI');
}
// No? OH NO!
else {
document.write('YOU ARE NOT ON WIFI - SORRY!!!')
}
</script>
<br /><br /><a href="javascript:history.go(0);">Click here to refresh the page</a> I got it working... ![]()
06-18-2012 05:52 AM