简体   繁体   English

phonegap android app仅显示连接到设备

[英]phonegap android app only showing connecting to device

I AM creating a phonegap android app. 我正在创建一个phonegap Android应用程序。 I am creating this app using help of this tutorial . 我正在使用本教程的帮助创建此应用程序。 When i am istalling this app on device its onDeviceReady function is not working. 当我在设备上安装此应用程序时,其onDeviceReady功能无法正常工作。 It is only showing coneecting to device. 它只显示对设备的连接。 My onDeviceReady function is below:- 我的onDeviceReady功能如下: -

onDeviceReady: function() {
    app.receivedEvent('deviceready');
    alert('device ready');
    try {
        var pushNotification = window.plugins.pushNotification;
        pushNotification.register(app.successHandler, app.errorHandler,{"senderID":"41327727848","ecb":"app.onNotificationGCM"});
    } catch (ex) {
        alert('error: ' + ex);
    }
},

It does not alert anything. 它没有提醒任何事情。 I can't find the error. 我找不到错误。

Here are the suggestions you can try: 以下是您可以尝试的建议:

  • make sure you have added cordova.js into your html file. 确保你已将cordova.js添加到你的html文件中。
  • deviceready function should be called after cordova.js is loaded. 应在加载cordova.js后调用deviceready函数。

the link you've provided is using old version version of plugin.( link-old plugin ).I advice you to follow the new one which is this 您所提供的链接是使用插件的旧版本的版本。( 链接旧插件 )。我建议您按照新的一个是这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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