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 proble
Update: This is actually working as expected. Here is the technical explanation:
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.
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>
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:
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"...
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.
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.