phonegap android app只显示连接到设备

时间:2022-03-25 16:32:12

I AM creating a phonegap android app. I am creating this app using help of this tutorial. When i am istalling this app on device its onDeviceReady function is not working. It is only showing coneecting to device. My onDeviceReady function is below:-

我正在创建一个phonegap Android应用程序。我正在使用本教程的帮助创建此应用程序。当我在设备上安装此应用程序时,其onDeviceReady功能无法正常工作。它只显示对设备的连接。我的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.

它没有提醒任何事情。我找不到错误。

1 个解决方案

#1


0  

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

你提供的链接是使用旧版本的插件。(link-old插件)。我建议你按照这个新的一个

#1


0  

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

你提供的链接是使用旧版本的插件。(link-old插件)。我建议你按照这个新的一个