简体   繁体   中英

how to get android device token with phonegap and pushbots

how to get android device token via phonegap and pushbots ?

i'm trying with this code but still not working !

 onDeviceReady: function() {
    app.receivedEvent('deviceready');

if(PushbotsPlugin.isiOS()){
PushbotsPlugin.initializeiOS("");
 }
 if(PushbotsPlugin.isAndroid()){
PushbotsPlugin.initializeAndroid("", "");
 }

 alert("outside alert");

 PushbotsPlugin.getToken(function(token){
  console.log(token);
  alert(token);
 });


}

resource : https://github.com/pushbots/phonegap

Just so its not a simple mistake, you need to have your pushbots app id and GCM codes in your initialize methods. ie

PushbotsPlugin.initializeiOS("5614a0fd1779591xxxxxxxxxx");

PushbotsPlugin.initializeAndroid("5614a0fd1779591xxxxxxxxxx", "65xxxxxxxxxx");

Also, they have just updated the plugin on phonegap npm so replace your current line in the config.xml with (if you are using phonegap build):

This should do the trick!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM