Worklight 6.2 Android应用程序未在推送通知时启动 [英] Worklight 6.2 Android Application not launching on push notification

查看:95
本文介绍了Worklight 6.2 Android应用程序未在推送通知时启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将推送通知用于在Worklight 6.2中编写的Android环境应用程序。我已经让应用程序接收推送通知,但是当我点击状态栏中的通知时,它会清除通知但不启动应用程序。

I am attempting to get push notifications to work on an Android environment app written in Worklight 6.2. I have gotten the app to receive push notifications, but when I tap on the notification in the status bar, it clears the notification but does not launch the app.

我有看看这里的答案, IBM Worklight 5.0.6.1 - 在关闭手机/应用程序时未获得推送通知,但将app_name字符串更改回应用程序的原始名称(如接受的答案所示),不会导致应用程序推出。我还尝试了另一个注释建议,从app描述符中删除displayName中的嵌入空格,这也没有用。

I have looked at the answer here, IBM Worklight 5.0.6.1 - Not getting Push Notifications when phone/app is closed, but changing the app_name string back to the original name of the app, as the accepted answer suggests, does not cause the app to launch. I also tried another one of the comments suggestions to remove embedded spaces from the displayName in the app descriptor, and that also did not work.

我看过logcat和没有看到任何消息表明它找不到要启动的应用程序。我希望那里的东西可以给我一个关于它正在寻找什么的提示,但是没有运气。

I've watched the logcat and do not see any messages to indicate that it failed to find an app to launch. I was hoping something in there would give me a hint as to what it is looking for, but no luck.

是否有另一个设置在哪里已经不同步所以单击通知不会启动应用程序?我自己找不到任何其他东西(可能因为它不存在)。

Is there another setting somewhere that has gotten out of sync so that clicking the notification does not launch the app? I cannot find anything else myself (probably because it doesn't exist).

谢谢

推荐答案

在回答以下问题时,请参阅我的解释。它还提供了一个解决方案:单击时未打开应用程序通知区域中的消息

See my explanation in my in answer to following question. It also provides a solution: App not opened when clicking on message in notification area

复制/粘贴相关文本:

res\values\strings.xml中的 app_name 值在内部用于创建Intent对象。因此,当应用关闭并且GCMIntentService收到消息时,它会创建一个意图,其操作为< packagename>。< 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 更改为任何其他字符串,内部的Intent将被创建为 com.PushNotifications。< new_name>

但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"...


这篇关于Worklight 6.2 Android应用程序未在推送通知时启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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