onDeviceReady function in visualneo web - Forum

Forum Navigation
Climate strike banner
You need to log in to create posts and topics.

onDeviceReady function in visualneo web

I have downloaded the "hello-world-sample-app-PhoneGap"

This sample app contents a file of javascript by the name of "index. js".

Inside this file, a function is defined named "onDeviceReady function() "

now, my question is this:

Where can I find or put this function in visualneo web?

It seems to be a PhoneGap only event.
Not sure, but adding this to Project(menu) > Events > Start-up should work:

NeoScriptToJS
BeginJS
  document.addEventListener("deviceready", neosubroutine.mySubroutine, false);
EndJS

Replace mySubroutine with your desired subroutine name.

How can I convert this javascript file code into visualneo code?

I have  need to embed this code under the section of on deviceReady function()

window.plugins.PushbotsPlugin.initialize("5d4704a2b794122a687a19c4", {"android":{"sender_id":"287556418731"}});
// Only with First time registration
window.plugins.PushbotsPlugin.on("registered", function(token){
 console.log("Registration Id:" + token);
});

//Get user registrationId/token and userId on PushBots, with evey launch of the app even launching with notification
window.plugins.PushbotsPlugin.on("user:ids", function(data){
 console.log("user:ids" + JSON.stringify(data));
});

It is important for creating  notification system with pushbots service.

 

 

 

How can I convert this javascript file code into visualneo code?

Hi @asmat, you don't need to convert it.
JavaScript code can be integrated into VisualNEO Web directly.
Just add the file to the project: Projects > Properties > Libraries/Files

I have need to embed this code under the section of on deviceReady function()

Just add the code I have shared above and then create a JavaScript subroutine:
Project > Subroutines... > New JavaScript Subroutine (name it mySubroutine)
Paste the code on the right and press OK

I'm very interested in finding a notification solution.
The service you have found seems quite interesting. Will take a look as soon as I can. Let me know if you have success please.
Regards.

I have made a sample pusher notification for PhoneGap-hello-world-app with pushbots and firebase according to instructions of the following youtube video but I could not do the same way for visualneo web, I have problem with javascript section of this topic.