应用程序的消息在通知区域中单击时没有打开 [英] App not opened when clicking on message in notification area

查看:120
本文介绍了应用程序的消息在通知区域中单击时没有打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个工作灯的应用程序,与推送通知的作品。我目前正在测试在Android和已经得到发送推送通知的应用程序适配器。现在的问题是:应用程序只接收它时,它是在前景。它不接受它,如果它是在背景和我打开它的消息显示之后,在通知区域。无论它的应用程序,当我点击通知区域内的邮件打开。

I am developing a Worklight app that works with push notifications. I am currently testing on Android and have got the adapter to send a push notification to the app. The problem is: the app only receives it when it is on the foreground. It doesn't receive it if it was on the background and I open it after a message is shown in the notifications area. Neither does the app open when I click on the message inside the notification area.

我已经研究了PushNotifications例子,好像我做的完全一样。我交叉检查的权限等。对那些在本例中的Andr​​oid清单文件。然而,它似乎并没有工作。运行PushNotifications例如,当下面是从日志的摘录。

I have studied the PushNotifications example and it seems like I am doing exactly the same. I cross-checked the permissions etc. in the Android manifest file against those in the example. However, it doesn't seem to work. Below is an excerpt from the log when running the PushNotifications example.

10-08 09:58:48.227: V/GCMBroadcastReceiver(2771): onReceive: com.google.android.c2dm.intent.RECEIVE
10-08 09:58:48.227: V/GCMBroadcastReceiver(2771): GCM IntentService class: com.PushNotifications.GCMIntentService
10-08 09:58:48.227: V/GCMBaseIntentService(2771): Acquiring wakelock
10-08 09:58:48.237: V/GCMBaseIntentService(2771): Intent service name: GCMIntentService-DynamicSenderIds-4
10-08 09:58:48.237: D/GCMIntentService(2771): GCMIntentService.onMessage in GCMIntentService.java:101 :: WLGCMIntentService: Received a message from the GCM server
10-08 09:58:48.237: W/GCMIntentService(2771): GCMIntentService.onMessage in GCMIntentService.java:108 :: Unable to update badge while received push notification, becasue failed to parse badge number null, badge must be an integer number.
10-08 09:58:48.257: V/GCMBaseIntentService(2771): Releasing wakelock
10-08 09:58:48.257: D/GCMIntentService(2771): GCMIntentService.addToIntentQueue in GCMIntentService.java:123 :: WLGCMIntentService: App is not on foreground. Queue the intent for later re-sending when app is back on foreground.
10-08 09:58:48.277: D/push(2771): Push$1.onReceive in Push.java:91 :: Push: Queuing message for dispatch to javascript
10-08 09:58:48.277: D/GCMIntentService(2771): GCMIntentService.onUnhandled in GCMIntentService.java:164 :: WLGCMIntentService: Showing notification for unhandled Message(alert=Hoi-hoi, badge=1, sound=null, payload={"alias":"myPush","custom":"data"})
10-08 09:59:20.837: D/Whitelist(2771): Unlimited access to network resources
10-08 09:59:20.837: I/CordovaLog(2771): Changing log level to DEBUG(3)
10-08 09:59:20.837: D/CordovaActivity(2771): Resuming the App
10-08 09:59:20.837: D/CordovaActivity(2771): CB-3064: The errorUrl is null
10-08 09:59:20.877: W/EGL_emulation(2771): eglSurfaceAttrib not implemented
10-08 09:59:20.907: D/dalvikvm(2771): GC_FOR_ALLOC freed 810K, 27% free 4785K/6516K, paused 25ms, total 25ms
10-08 09:59:20.917: D/push(2771): Push.dispatchPending in Push.java:390 :: Dispatching to javascript Message(alert=Hoi-hoi, badge=1, sound=null, payload={"alias":"myPush","custom":"data"})
10-08 09:59:20.917: D/WLClient(2771): WLClient$ActivityListener.onActivityStarted in WLClient.java:1180 :: on activity started com.PushNotifications.PushNotifications
10-08 09:59:20.917: D/WLClient(2771): WLClient$ActivityListener.onActivityResumed in WLClient.java:1169 :: on activity resumed com.PushNotifications.PushNotifications . activity count = 1

我的一种是几乎相同的,所不同的是在第三行从下方(D /推(2771):Push.dispatchPending)缺失。它似乎永远不会调度排队的事件到应用程序。

My one is almost the same, except that the third line from below (D/push(2771): Push.dispatchPending) is missing. It never seems to dispatch the enqueued event to the app.

什么可能我会丢失?

工作灯的版本是6.2.0.00-20140922-2259。

Worklight version is 6.2.0.00-20140922-2259.

推荐答案

更新:的这实际上是按预期工作。下面是技术性的解释:

Update: This is actually working as expected. Here is the technical explanation:

在水库的 APP_NAME 值\值\ strings.xml中用于内部创建意向对象。因此,当应用程序被关闭,GCMIntentService收到一条消息,它会创建与行动意图为<包名称>< APP_NAME> 并将其发送到通知服务显示在通知栏上的通知。

The app_name value in res\values\strings.xml is used internally to create Intent objects. So when the app is closed and the GCMIntentService receives a message, it creates an intent with the action as <packagename>.<app_name> and send it to notification service to show the notification in the notifications bar.

这是因为用于在AndroidManifest.xml中,表示该应用程序的意图名字已经被上轻敲通知发布:

This is the intent name as used in AndroidManifest.xml to indicate that app has to be launched on tapping the notification:

<activity android:name=".PushNotifications" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|screenSize" android:launchMode="singleTask" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:screenOrientation="sensor"> 
    ....
    <intent-filter> 
        <action android:name="com.PushNotifications.PushNotifications.NOTIFICATION"/>  
        <category android:name="android.intent.category.DEFAULT"/> 
    </intent-filter> 

所以,现在如果 APP_NAME 更改为其他任何字符串,在内部的意图将创建为 com.PushNotifications&LT; NEW_NAME&GT;
但AndroidManifest.xml中仍然有例如 com.PushNotifications.PushNotifications (示例应用程序的情况下),因此应用程序是没有得到启动的意图动作是不同的。

So now if the app_name is changed to any other string, internally the Intent will be created as com.PushNotifications.<new_name>.
But the AndroidManifest.xml still has for example com.PushNotifications.PushNotifications (in the case of the sample application), so the app is not getting launched as the intent action is different.

要显示一个不同的名称申请,请按照下列步骤操作:

To display the application with a different name, follow these steps:

  1. 在strings.xml中,添加一个额外的new_name_value
  2. 在AndroidManifest.xml中,修改标签与新的字符串名称

  1. In strings.xml, add an additional new_name_value
  2. In AndroidManifest.xml , modify the label with the new string name

<application android:label="@string/app_new_name" android:icon="@drawable/icon"> 
<activity android:name=".PushNotifications" android:label="@string/app_new_name"...

从评论:看来,如果改变Android的应用程序的名称资源\值\ strings.xml中,应用程序将无法窃听来电通知后,启动


From the comments: it seems that if changing the application name in Android's res\values\strings.xml, the application will not launch after tapping an incoming notification.

开发团队目前正在调查一份类似的报告,所以我的建议是为了把它研究了你的工作​​灯的版本,以及打开PMR。

The development team is currently investigating a similar report, so my suggestion is to open a PMR in order to have it investigated for your version of Worklight as well.

当前唯一可用的解决办法是改回应用程序名称回到最初创建名称为应用程序,

The only currently available workaround is to change back the application name back to the originally created name for the application,

或者,创建应用程序的创建后更改它的一个新的应用程序,但与所需的名称这一次吧。

Or, create a new application but this time with the desired name instead of changing it after the application creation.

这篇关于应用程序的消息在通知区域中单击时没有打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆