Groups
Sign in
Groups
comp.mobile.nokia.8110
Conversations
Labels
About
Send feedback
Help
enable wifi with javascript
319 views
questions
Skip to first unread message
perry
unread,
Jul 16, 2019, 9:08:38 AM
7/16/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to comp.mobile.nokia.8110
Hello,
I would use the
SettingsApi
to toggle wifi on/off.
but I run into an error.
my code snippet:
function wifi_toggle()
{
var lock = navigator.mozSettings.createLock();
var setting = lock.get('wifi.enabled');
setting.onsuccess = function () {
alert('wifi.enabled: ' + setting.result);
}
setting.onerror = function () {
alert('An error occured: ' + setting.error);
}
}
error output
: TypeError: navigator.mozSettings is undefined
does somebody know how to use the api ?
Farooq Karimi Zadeh
unread,
Jul 16, 2019, 9:16:42 AM
7/16/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to perry, comp.mobile.nokia.8110
On 2019-07-16 17:38, perry wrote:
> Hello,
>
> I would use the SettingsApi [1] to toggle wifi on/off.
> but I run into an error.
>
> MY CODE SNIPPET:
>
> function wifi_toggle()
> {
>
> var lock = navigator.mozSettings.createLock();
>
> var setting = lock.get('wifi.enabled');
>
> setting.onsuccess = function () {
> alert('wifi.enabled: ' + setting.result);
> }
>
> setting.onerror = function () {
> alert('An error occured: ' + setting.error);
> }
>
> }
>
> ERROR OUTPUT: TypeError: navigator.mozSettings is undefined
>
> does somebody know how to use the api ?
>
> --
> You received this message because you are subscribed to the Google
> Groups "comp.mobile.nokia.8110" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
bananahacker...@googlegroups.com
.
> To post to this group, send email to
banana...@googlegroups.com
.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/bananahackers/6a416412-291b-45e1-9e15-08cff3e142bc%40googlegroups.com
> [2].
> For more options, visit
https://groups.google.com/d/optout
.
>
>
> Links:
> ------
> [1]
https://developer.mozilla.org/en-US/docs/Archive/B2G_OS/API/Settings_API
> [2]
>
https://groups.google.com/d/msgid/bananahackers/6a416412-291b-45e1-9e15-08cff3e142bc%40googlegroups.com?utm_medium=email&utm_source=footer
permissions perhaps?
perry
unread,
Jul 16, 2019, 9:22:05 AM
7/16/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to comp.mobile.nokia.8110
Farooq Karimi Zadeh
thanks for the tip.
"permissions":
{
"desktop-notification":{},
"geolocation": {
"description": "Required to show user's location"
},
"device-storage:sdcard": {
"description": "Read from sd-card",
"access": "readonly"
},
"open-remote-window":{},
"device-storage:apps":{ "access": "readonly" },
"webapps-manage":{ },
"settings":
{
"access":"readwrite"
},
"wifi-manage":{},
"spatialnavigation-app-manage": {
"navigator.spatialNavigationEnabled": false
},
"systemXHR": {
"description": "Required to load remote content"
Reply all
Reply to author
Forward
0 new messages