Reputation: 1731
I added the above code in main.js
inside the wlCommonInit
function.
var options = {
onSuccess: succ,
onFailure: fail
};
WL.Device.getID(options);
function succ(data) {
alert('succ ' + JSON.stringify(data));
}
function fail() {
alert('fail');
}
But I am getting Uncaught TypeError: WL.Device.getID is not a function
error in desktop web console.
Is it possible to add this code in other js files?
Please suggest!!
Upvotes: 0
Views: 878
Reputation: 44516
Per the documentation, this API method is not available in Desktop browsers. It is available only for mobile devices: http://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.apiref.doc/html/refjavascript-client/html/WL.Device.html%23getID
Supported environments: Android, iOS, WindowsPhone8, Blackberry, Blackberry10.
Upvotes: 1
Reputation: 2681
Since you see it in Desktop web console, I take it you are trying out Desktop Browser environment/ Mobile Web app.
This API is not applicable in either case. It works only on Android, iOS, WindowsPhone8, Blackberry, Blackberry10. For more details refer to KnowledgeCenter.
Upvotes: 1