简体   繁体   English

Android中的phonegap的urbanairship通知插件的问题

[英]issue with urbanairship notification plugin of phonegap in android

I've created a new application with cli with phonegap. 我使用cli和phonegap创建了一个新应用程序。 everything is going well my app running successfully on emulator and device. 一切顺利,我的应用程序已在模拟器和设备上成功运行。

Now i want to use urbanairship push notification. 现在,我想使用urbanairship推送通知。 i followed the following url 我按照以下网址

https://github.com/urbanairship/phonegap-ua-push/blob/master/README.md https://github.com/urbanairship/phonegap-ua-push/blob/master/README.md

replaced the css, js and index.html from example to my application. 将示例中的CSS,JS和index.html替换为我的应用程序。

I use the following command to add the plugin 我使用以下命令添加插件

phonegap local plugin add https://github.com/urbanairship/phonegap-ua-push.git phonegap本地插件添加https://github.com/urbanairship/phonegap-ua-push.git

plugin added successfully i changed the key and config.xml 插件添加成功,我更改了密钥和config.xml

<!-- Urban Airship app credentials -->
<preference name="com.urbanairship.production_app_key" value="__SOMETHINGTBmsZLE__SOMETHING" />
<preference name="com.urbanairship.production_app_secret" value="dWFIJuLST__SOMETHING" />
<preference name="com.urbanairship.development_app_key" value="__SOMETHING_3z1gAh__SOMETHING" />
<preference name="com.urbanairship.development_app_secret" value="dWFIJuL__SOMETHING" />

<!-- If the app is in production or not -->
<preference name="com.urbanairship.in_production" value="false" />

<!-- Enable push when the application launches (instead of waiting for enablePush js call).  Defaults to false -->
<preference name="com.urbanairship.enable_push_onlaunch" value="true" />

<!-- Only required for Android. -->
<preference name="com.urbanairship.gcm_sender" value="AIzaSyC5rS_Gv__SOMETHING" />

when i run application on emulator with following command 当我使用以下命令在模拟器上运行应用程序时

phonegap run android phonegap运行android

It is running well but my device is not registering on urbanairship. 它运行良好,但我的设备未在Urbanairship上注册。 then i open android project in adt (android developement tool ) in eclipse and run from there application running but i got some error in log console. 然后我在eclipse中的adt(android开发工具)中打开android项目,并从那里运行应用程序运行,但是我在日志控制台中遇到了一些错误。

在此处输入图片说明

i want to know what is wrong with my application. 我想知道我的申请出了什么问题。

I honestly do not know why, but you need to have the in_production flag set to true to get push notifications to work on Android. 老实说,我不知道为什么,但是您需要将in_production标志设置为true才能使推送通知在Android上运行。

This was rather annoying when trying to make an application for both iOS and Android as I had to put the dev keys in for the prod. 尝试同时为iOS和Android制作应用程序时,这很烦人,因为我必须为产品插入开发密钥。 It could also lead to some confusion with deployment. 这也可能导致与部署有些混淆。 But, doing this will make it work. 但是,这样做将使其起作用。

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

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