How to edit the Android.manifest.template.xml file to receive Push Notifications

  

Let me restructure this question. My objective is try and get some assistance with setting up Push Notifications on a cross-platform Delphi App (iOS & Android). I initially followed a blog post by Sarina Du Pont via Embarcadero here.

I gather that you have to adjust your Android.manifest.template.xml file with the additional permission entries, as explained quite well via this blog post. However, having done this exactly, my Android app still does not receive any Push Notifications. I have included my Android manifest template file here:

<?xml version=”1.0″ encoding=”utf-8″?>

package=”%package%”

android:versionCode=”%versionCode%”

android:versionName=”%versionName%”>

<!– This is the platform API where NativeActivity was introduced. –>

<uses-sdk android:minSdkVersion=”%minSdkVersion%” />

<!– GCM connects to Google Services. –>
<uses-permission android:name=”android.permission.INTERNET” />

<!– GCM requires a Google account. –>
<uses-permission android:name=”android.permission.GET_ACCOUNTS” />

<!– Keeps the processor from sleeping when a message is received. –>
<uses-permission android:name=”android.permission.WAKE_LOCK” />

<!–
Creates a custom permission so only this app can receive its messages.

NOTE: the permission *must* be called PACKAGE.permission.C2D_MESSAGE,
where PACKAGE is the application’s package name.
–>
<permission android:name=”%package%.permission.C2D_MESSAGE”
android:protectionLevel=”signature” />
<uses-permission android:name=”%package%.permission.C2D_MESSAGE” />

<!– This app has permission to register and receive data message. –>
<uses-permission
android:name=”com.google.android.c2dm.permission.RECEIVE” />

<application android:persistent=”%persistent%”

android:restoreAnyVersion=”%restoreAnyVersion%”

android:label=”%label%”

android:installLocation=”%installLocation%”

android:debuggable=”%debuggable%”

android:largeHeap=”%largeHeap%”

android:icon=”%icon%”

android:theme=”@style/MyTheme.NoTitleBar.SplashWindow”>

<!– Our activity is a subclass of the built-in NativeActivity framework class.

This will take care of integrating with our NDK code. –>

<activity android:name=”com.embarcadero.firemonkey.FMXNativeActivity”

android:label=”%activityLabel%”

android:configChanges=”orientation|keyboardHidden”>

<!– Tell NativeActivity the name of our .so –>

<meta-data android:name=”android.app.lib_name”

android:value=”%libNameValue%” />

<intent-filter>

<action android:name=”android.intent.action.MAIN” />

<category android:name=”android.intent.category.LAUNCHER” />

</intent-filter>
<receiver
android:name=”com.embarcadero.gcm.notifications.GCMNotification” android:exported=”true”
android:permission=”com.google.android.c2dm.permission.SEND” >
<intent-filter>
<action android:name=”com.google.android.c2dm.intent.RECEIVE” />
<category android:name=”%package%” />
</intent-filter>
</receiver>

<service android:name=”com.embarcadero.gcm.notifications.GCMIntentService” />

</activity>

<receiver android:name=”com.embarcadero.firemonkey.notifications.FMXNotificationAlarm” />

</application>

Have I done something wrong?

Comments are closed.