我使用Cordova 3.0和Visual Studio 2013制作了一个android应用;在此应用程序中,我已将此Push Notification插件与Google Cloud Messaging Service一起使用。
Register App运行正常,因为我从GCM获得了RegID,Web服务器中的Register也正常运行,但是,当我向设备发送任何通知时,我遇到了一个问题:App在接收到Push时崩溃,并且没有什么也没显示。
我没有日志,因为该应用程序位于Cordova上,而Visual Studio无法调试此应用程序类型。
请帮助我解决此问题。
先感谢您。问候来自墨西哥。
好吧,的确,经过大量研究,我终于可以在VS中调试我的App(启动adb.exe时遇到问题)。在日志中,我可以看到我的代码在创建接收器时出现了一个错误,这是一个错误:Unable to instantiate receiver com.myapp.GcmBroadcastReceiver
我查看了一下,发现我的AndroidManifest.xml中可能有一个错误;然后我完全按照Cordova文档中的说明进行操作,然后...起作用了!
这是Android Manifest权限,还有更多内容(以下是Docs):
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="$PACKAGE_NAME.permission.C2D_MESSAGE" />
<activity android:name="com.plugin.gcm.PushHandlerActivity"/>
<receiver android:name="com.plugin.gcm.CordovaGCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="$PACKAGE_NAME" />
</intent-filter>
</receiver>
<service android:name="com.plugin.gcm.GCMIntentService" />
谢谢你们
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句