繁体   English   中英

mobilefirst推送通知更改android app_name

[英]mobilefirst push notification change android app_name

您好,我在mobilefirst 6.3混合应用程序中工作,从string.xml更改app_name时出现问题。

我有我的混合名称应用程序<string name="app_name">ASDFGHJK</string> ,当我更改了<string name="app_name">ASDF GHJK</string> ,我将其更改为<string name="app_name">ASDF GHJK</string>

当应用程序在后台运行时,单击推送不执行任何操作,而在应用程序中即时消息不触发接收器方法时,如何解决我的应用程序名称出现此问题呢?

res \\ values \\ strings.xml中的app_name值在内部用于创建Intent对象。 因此,当应用程序关闭且GCMIntentService收到消息时,它将创建一个动作为<packagename>.<app_name>的意图,并将其发送到通知服务以在通知栏中显示通知。

这是AndroidManifest.xml中使用的意图名称,用于指示必须在点击通知时启动应用程序:

<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 (对于示例应用程序),因此,由于意图操作有所不同,因此该应用程序无法启动。

要使用其他名称显示应用程序,请按照下列步骤操作:

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

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

暂无
暂无

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

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