Android Push notification setup

I followed the blog post about implementing push notifications in android very closely, and I am able to get the notification token when I build through the simulator. But when I run an enterprise build I am not able to get the token.

I tried adding the permissions to the android manifest, but I dont see a clean place to add the projectNumber without hijacking the GCM broadcast receiver.

Any ideas? Is there anything special to do for enterprise builds? [import]uid: 95944 topic_id: 34526 reply_id: 334526[/import]

Jesse - just in case, I am copying Josh’s response on your blog comment here as well:


jesse,

You need to add some Corona related things to your AndroidManifest.xml file to get push notifications working. If you download the newest Corona Enterprise daily build, notice that all of the sample projects’ AndroidManifest.xml files have been updated. You’ll need to copy over the following service and receivers from the sample project’s AndroidManifest.xml file to your file…

  • CoronaService
  • SystemStartupBroadcastReceiver
  • AlarmManagerBroadcastReceiver
  • StatusBarBroadcastReceiver
  • GoogleCloudMessagingBroadcastReceiver

You’ll also need to add the permissions you see in sample project “Notifications/GooglePushNotifications” to your AndroidManifest.xml file as well.

From there, just follow the instructions that you see in the GooglePushNotifications sample project. And don’t forget to add your ProjectNumber to your config.lua file.

I hope this helps.


[import]uid: 10668 topic_id: 34526 reply_id: 137319[/import]

Jesse - just in case, I am copying Josh’s response on your blog comment here as well:


jesse,

You need to add some Corona related things to your AndroidManifest.xml file to get push notifications working. If you download the newest Corona Enterprise daily build, notice that all of the sample projects’ AndroidManifest.xml files have been updated. You’ll need to copy over the following service and receivers from the sample project’s AndroidManifest.xml file to your file…

  • CoronaService
  • SystemStartupBroadcastReceiver
  • AlarmManagerBroadcastReceiver
  • StatusBarBroadcastReceiver
  • GoogleCloudMessagingBroadcastReceiver

You’ll also need to add the permissions you see in sample project “Notifications/GooglePushNotifications” to your AndroidManifest.xml file as well.

From there, just follow the instructions that you see in the GooglePushNotifications sample project. And don’t forget to add your ProjectNumber to your config.lua file.

I hope this helps.


[import]uid: 10668 topic_id: 34526 reply_id: 137319[/import]

Hello,

I am also experiencing issues with this. For one, in the newest build #999 I do not see a sample project for setting up push notifications. I have currently put the following in my manifest (along with the CoronaService, SystemStartupBroadcastReceiver, AlarmManagerBroadcastReceiver, StatusBarBroadcastReceiver and GoogleCloudMessagingBroadcastReceiver):

<permission android:name="com.YAAC.YACGfree.permission.C2D_MESSAGE"> android:protectionLevel="signature" /&gt;<br> <br> <!-- Permissions required by this app. --><br> <uses-permission android:name="android.permission.INTERNET"></uses-permission><br> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission><br> <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission><br> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission><br> <br> <uses-permission android:name="com.YAAC.YACGfree.permission.C2D_MESSAGE"></uses-permission><br> <uses-permission android:name="android.permission.GET_ACCOUNTS"></uses-permission><br> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission><br> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"></uses-permission><br> <uses-permission android:name="com.android.vending.BILLING"></uses-permission><br>

And following in my config file:

<br> android =<br> {<br> permissions =<br> {<br> { name = ".permission.C2D_MESSAGE", protectionLevel = "signature" },<br> },<br> usesPermissions =<br> {<br> "android.permission.INTERNET",<br> "android.permission.GET_ACCOUNTS",<br> "android.permission.RECEIVE_BOOT_COMPLETED",<br> "com.google.android.c2dm.permission.RECEIVE",<br> ".permission.C2D_MESSAGE",<br> "android.permission.ACCESS_NETWORK_STATE",<br> "com.android.vending.BILLING",<br> },<br> },<br>

When I try to run this, the error I get is:

<br>[c2DMReg] handleRequest caught javax.net.ssl.SSLHandshake Exception: com.android.org.bouncycastle.jce.exception.ExtCerPathValidatorException: Could not validate certificate: current time: ....<br>

Please advice! :slight_smile: [import]uid: 66464 topic_id: 34526 reply_id: 137846[/import]

The above error message was entirely on my end: for some reason my testing device had the date set to 1980, which messed things up.

I do still not receive the registration event though, so any advice on what my manifest or config file is missing would be appreciated. [import]uid: 66464 topic_id: 34526 reply_id: 137858[/import]

Thanks for getting that update in there. Unfortunately, I’m still jammed up:

  1. I dont see a GooglePushNotifications sample project in the Corona SDK — am I supposed to use the actual Google one?

  2. If I am to use the google one, should I make my own
    ‘com.mycompany.myapp.GCMIntentService’ class to handle GCM notifications?

  3. If I am set up properly, is it possible that ‘remoteRegistration’ events dont get automatically sent in Enterprise? Is there a way to trigger this event myself?

  4. Is there ANY other code needed to modify besides the androidmanifest.xml or config.lua? As it stands now, I am able to verify that push works in sim-builds, but not enterprise-builds [import]uid: 95944 topic_id: 34526 reply_id: 137967[/import]

Jesse, Mathias,

First, I recommend that you have a look at sample project “Notifications/GooglePushNotifications” that is included with the Corona Simulator (ie: not Corona Enterprise). The idea is to verify that you have everything properly configured on Google’s website. Instructions on how to set this up can be found in this sample project’s “config.lua” and “main.lua” file. Once you’re able to get this sample project to successfully push a notification to itself, you’re then ready to get this going on Corona Enterprise below.

Next, you need to set up your Corona Enterprise Android project…

  1. Set up you “config.lua” just like how you did it in the above sample project. Corona needs the “projectNumber” in this file in order to register for push notifications.
  2. Merge the latest changes from any Corona Enterprise sample project’s AndroidManifest.xml file to your project’s AndroidManifest.xml file. You should use a diff tool do this. Notice that our AndroidManifest.xml file has new tags in the newest daily build as David has noted up above. Specifically…
  • CoronaService
  • SystemStartupBroadcastReceiver
  • AlarmManagerBroadcastReceiver (Only needed by local notifications.)
  • StatusBarBroadcastReceiver
  • GoogleCloudMessagingBroadcastReceiver
  1. Add the Android permissions that you see in the GooglePushNotification’s “build.settings” file to your project’s AndroidManifest.xml file.

And that’s it.

Note: The “build.settings” file is not used by a Corona Enterprise project. This file is only used by the Corona Simulator which it uses to manipulate the APK’s AndroidManifest.xml file. But since you are doing native Android development, it’s your responsibility to manage the AndroidManifest.xml file… which means you have ultimate control over you app project.

Final Note: We do not have a Corona Enterprise “push notification” sample project. This is because all of our Corona Enterprise sample projects support Google push notifications. All you have to do is drop in the GooglePushNotifications sample project provided by our Corona Simulator to one of the Corona Enterprise sample projects, add the needed permissions to your AndroidManifest.xml file, and *boom* you’re done.
[import]uid: 32256 topic_id: 34526 reply_id: 138187[/import]

Still no dice. I am pretty sure I am configured ok with google because I can get the the remoteRegistration+token just fine when I build with the non-enterprise version, but as soon as I build with enterprise it doesnt show up.

Here is what I have -

My android manifest looks like this:

<?xml version="1.0" encoding="utf-8"?>  
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> package="com.mycompany.myapp"<br> android:versionCode="33"<br> android:versionName="3.3"<br> android:installLocation="auto"&gt;<br><br> <uses-sdk android:minsdkversion="8" android:targetsdkversion="16"></uses-sdk><br><br> <!-- GCM --><br> <permission android:name="com.mycompany.myapp.permission.C2D_MESSAGE" android:protectionlevel="signature"></permission><br><br> <!-- Permissions required by this app. --><br> <uses-permission android:name="com.android.vending.BILLING"></uses-permission><br> <uses-permission android:name="android.permission.INTERNET"></uses-permission><br> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission><br> <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission><br> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission> <!--tapjoy--><br> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission> <!--tapjoy--><br><br> <uses-permission android:name="android.permission.GET_ACCOUNTS"></uses-permission><br> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission><br> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"></uses-permission><br> <uses-permission android:name=".permission.C2D_MESSAGE"></uses-permission><br><br> <!-- Informs the app store that this app requires OpenGL ES 1.1 as a minimum. Required by Corona. --><br> <uses-feature android:glesversion="0x00010001"></uses-feature><br><br> <!-- Informs the app store what features are required or are optional for this app. --><br> <!-- Setting the telephony feature to not required allows this app to be installed by devices that are not phones. --><br> <uses-feature android:name="android.hardware.telephony" android:required="false"></uses-feature><br> <!-- Listens for Google Cloud Messaging push notifications and registration messages. --><br> <receiver android:name="com.ansca.corona.notifications.GoogleCloudMessagingBroadcastReceiver"> android:permission="com.google.android.c2dm.permission.SEND" &gt;<br> <intent-filter><br> <action android:name="com.google.android.c2dm.intent.RECEIVE"></action><br> <action android:name="com.google.android.c2dm.intent.REGISTRATION"></action><br> <category android:name="."></category><br> </intent-filter><br> </receiver><br><br> <application android:name="CoronaApplication"> android:label="Myapp"<br> android:hardwareAccelerated="true"<br> android:debuggable="true"<br> android:icon="@drawable/icon" &gt;<br> <!-- The main Corona activity that runs the Corona project. --><br> <activity android:name="com.ansca.corona.CoronaActivity"> android:screenOrientation="portrait"<br> android:configChanges="keyboardHidden|orientation|screenSize"<br> android:label="Phrases"<br> android:launchMode="singleTask"<br> android:theme="@android:style/Theme.NoTitleBar.Fullscreen"&gt;<br> <intent-filter><br> <action android:name="android.intent.action.MAIN"></action><br> <category android:name="android.intent.category.LAUNCHER"></category><br> </intent-filter><br> </activity><br><br> <!-- Other Corona activities that can be launched by the main Corona activity. --><br> <activity android:name="com.ansca.corona.CameraActivity"> android:theme="@android:style/Theme.NoTitleBar.Fullscreen"<br> android:configChanges="keyboardHidden|orientation|screenSize"<br> android:screenOrientation="portrait" /&gt;<br> <activity android:name="com.ansca.corona.VideoActivity"> android:theme="@android:style/Theme.NoTitleBar.Fullscreen"<br> android:configChanges="keyboardHidden|orientation|screenSize" /&gt;<br><br> <!-- Corona content provider required by the video player and mail app to access this app's local files. --><br> <provider android:name="com.ansca.corona.FileContentProvider"> android:authorities="com.mycompany.myapp.files" /&gt;<br><br> <service android:name="BillingService"></service><br><br> <!-- Corona service used to perform background operations such as managing notifications. --><br> <service android:name="com.ansca.corona.CoronaService"></service><br> <br> <receiver android:name="com.ansca.corona.SystemStartupBroadcastReceiver"><br> <intent-filter><br> <action android:name="android.intent.action.BOOT_COMPLETED"></action><br> </intent-filter><br> </receiver><br><br> <!-- Handles local/scheduled notification events. --><br> <receiver android:name="com.ansca.corona.notifications.AlarmManagerBroadcastReceiver"></receiver><br> <receiver android:name="com.ansca.corona.notifications.StatusBarBroadcastReceiver"></receiver><br><br> <!-- Listens for Google Play/Marketplace in-app purchase responses and notifications. --><br> <receiver android:name="com.ansca.corona.purchasing.GoogleStoreBroadcastReceiver"><br> <intent-filter><br> <action android:name="com.android.vending.billing.IN_APP_NOTIFY"></action><br> <action android:name="com.android.vending.billing.RESPONSE_CODE"></action><br> <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED"></action><br>	</intent-filter><br> </receiver><br><br> </provider></activity></activity></application><br></manifest>  
  

and then in my config.lua i have this:

  
application =  
{  
 content =  
 {  
 width = c\_width,  
 height = c\_height,  
 scale = c\_scale  
 },  
 notification =  
 {  
 iphone =  
 {  
 types =  
 {  
 "badge", "sound", "alert"  
 }  
 },  
 google =  
 {  
 projectNumber = "75355xxxxx",  
 },  
 }  
}  
  

and to collect the events, I have this in my main.lua:

[code]
– -> NOTIFICATIONS
local function onNotification( event )
fxpcall(function()
if(event.token ~= nil) then
notification_token = event.token – setting global for now :confused:
end
if event.type == “remoteRegistration” then
native.showAlert( “remoteRegistration”, event.token, { “OK” } )
elseif event.type == “remote” then
user.getUser(nil, false)
native.showAlert( “Alert”, event.alert, { “OK” } )
–native.showAlert( “remote”, json.encode( event ), { “OK” } )
end
end)
end

Runtime:addEventListener( “notification”, onNotification)
– NOTIFICATION END
[/code] [import]uid: 95944 topic_id: 34526 reply_id: 138197[/import]

You need to change the following tag…
[lua][/lua]
…to…
[lua][/lua]

Android does not accept permission strings starting with a leading period. That is a Corona Simulator feature which tells it to automatically prefix the package name, making it simple for Corona Simulator users. Google doesn’t make it so simple for native developers. This matches the settings that Google documents here…
http://developer.android.com/google/gcm/gs.html#android-app

Also, your “GoogleCloudMessagingBroadcastReceiver” has 2 mistakes.

  1. This tag must be inside of the [lua][/lua] tag, like how it is shown in the sample project’s AndroidManifest.xml file.
    2) Your [lua][/lua] tag is set up wrong. You cannot use a period ‘.’ for the name. It must be set to your app’s package name as shown in the sample project and in Google instructions (see link above).
    [import]uid: 32256 topic_id: 34526 reply_id: 138211[/import]

You sir, are a gentleman and a scholar.

Those fixes did it. [import]uid: 95944 topic_id: 34526 reply_id: 138325[/import]

Great! Josh knows his stuff.
[import]uid: 10668 topic_id: 34526 reply_id: 138329[/import]

Oh good! I’m glad it’s working for you! [import]uid: 32256 topic_id: 34526 reply_id: 138373[/import]

Hello,

I am also experiencing issues with this. For one, in the newest build #999 I do not see a sample project for setting up push notifications. I have currently put the following in my manifest (along with the CoronaService, SystemStartupBroadcastReceiver, AlarmManagerBroadcastReceiver, StatusBarBroadcastReceiver and GoogleCloudMessagingBroadcastReceiver):

<permission android:name="com.YAAC.YACGfree.permission.C2D_MESSAGE"> android:protectionLevel="signature" /&gt;<br> <br> <!-- Permissions required by this app. --><br> <uses-permission android:name="android.permission.INTERNET"></uses-permission><br> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission><br> <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission><br> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission><br> <br> <uses-permission android:name="com.YAAC.YACGfree.permission.C2D_MESSAGE"></uses-permission><br> <uses-permission android:name="android.permission.GET_ACCOUNTS"></uses-permission><br> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission><br> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"></uses-permission><br> <uses-permission android:name="com.android.vending.BILLING"></uses-permission><br>

And following in my config file:

<br> android =<br> {<br> permissions =<br> {<br> { name = ".permission.C2D_MESSAGE", protectionLevel = "signature" },<br> },<br> usesPermissions =<br> {<br> "android.permission.INTERNET",<br> "android.permission.GET_ACCOUNTS",<br> "android.permission.RECEIVE_BOOT_COMPLETED",<br> "com.google.android.c2dm.permission.RECEIVE",<br> ".permission.C2D_MESSAGE",<br> "android.permission.ACCESS_NETWORK_STATE",<br> "com.android.vending.BILLING",<br> },<br> },<br>

When I try to run this, the error I get is:

<br>[c2DMReg] handleRequest caught javax.net.ssl.SSLHandshake Exception: com.android.org.bouncycastle.jce.exception.ExtCerPathValidatorException: Could not validate certificate: current time: ....<br>

Please advice! :slight_smile: [import]uid: 66464 topic_id: 34526 reply_id: 137846[/import]

The above error message was entirely on my end: for some reason my testing device had the date set to 1980, which messed things up.

I do still not receive the registration event though, so any advice on what my manifest or config file is missing would be appreciated. [import]uid: 66464 topic_id: 34526 reply_id: 137858[/import]

Thanks for getting that update in there. Unfortunately, I’m still jammed up:

  1. I dont see a GooglePushNotifications sample project in the Corona SDK — am I supposed to use the actual Google one?

  2. If I am to use the google one, should I make my own
    ‘com.mycompany.myapp.GCMIntentService’ class to handle GCM notifications?

  3. If I am set up properly, is it possible that ‘remoteRegistration’ events dont get automatically sent in Enterprise? Is there a way to trigger this event myself?

  4. Is there ANY other code needed to modify besides the androidmanifest.xml or config.lua? As it stands now, I am able to verify that push works in sim-builds, but not enterprise-builds [import]uid: 95944 topic_id: 34526 reply_id: 137967[/import]

Jesse, Mathias,

First, I recommend that you have a look at sample project “Notifications/GooglePushNotifications” that is included with the Corona Simulator (ie: not Corona Enterprise). The idea is to verify that you have everything properly configured on Google’s website. Instructions on how to set this up can be found in this sample project’s “config.lua” and “main.lua” file. Once you’re able to get this sample project to successfully push a notification to itself, you’re then ready to get this going on Corona Enterprise below.

Next, you need to set up your Corona Enterprise Android project…

  1. Set up you “config.lua” just like how you did it in the above sample project. Corona needs the “projectNumber” in this file in order to register for push notifications.
  2. Merge the latest changes from any Corona Enterprise sample project’s AndroidManifest.xml file to your project’s AndroidManifest.xml file. You should use a diff tool do this. Notice that our AndroidManifest.xml file has new tags in the newest daily build as David has noted up above. Specifically…
  • CoronaService
  • SystemStartupBroadcastReceiver
  • AlarmManagerBroadcastReceiver (Only needed by local notifications.)
  • StatusBarBroadcastReceiver
  • GoogleCloudMessagingBroadcastReceiver
  1. Add the Android permissions that you see in the GooglePushNotification’s “build.settings” file to your project’s AndroidManifest.xml file.

And that’s it.

Note: The “build.settings” file is not used by a Corona Enterprise project. This file is only used by the Corona Simulator which it uses to manipulate the APK’s AndroidManifest.xml file. But since you are doing native Android development, it’s your responsibility to manage the AndroidManifest.xml file… which means you have ultimate control over you app project.

Final Note: We do not have a Corona Enterprise “push notification” sample project. This is because all of our Corona Enterprise sample projects support Google push notifications. All you have to do is drop in the GooglePushNotifications sample project provided by our Corona Simulator to one of the Corona Enterprise sample projects, add the needed permissions to your AndroidManifest.xml file, and *boom* you’re done.
[import]uid: 32256 topic_id: 34526 reply_id: 138187[/import]

Still no dice. I am pretty sure I am configured ok with google because I can get the the remoteRegistration+token just fine when I build with the non-enterprise version, but as soon as I build with enterprise it doesnt show up.

Here is what I have -

My android manifest looks like this:

<?xml version="1.0" encoding="utf-8"?>  
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> package="com.mycompany.myapp"<br> android:versionCode="33"<br> android:versionName="3.3"<br> android:installLocation="auto"&gt;<br><br> <uses-sdk android:minsdkversion="8" android:targetsdkversion="16"></uses-sdk><br><br> <!-- GCM --><br> <permission android:name="com.mycompany.myapp.permission.C2D_MESSAGE" android:protectionlevel="signature"></permission><br><br> <!-- Permissions required by this app. --><br> <uses-permission android:name="com.android.vending.BILLING"></uses-permission><br> <uses-permission android:name="android.permission.INTERNET"></uses-permission><br> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission><br> <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission><br> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission> <!--tapjoy--><br> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission> <!--tapjoy--><br><br> <uses-permission android:name="android.permission.GET_ACCOUNTS"></uses-permission><br> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission><br> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"></uses-permission><br> <uses-permission android:name=".permission.C2D_MESSAGE"></uses-permission><br><br> <!-- Informs the app store that this app requires OpenGL ES 1.1 as a minimum. Required by Corona. --><br> <uses-feature android:glesversion="0x00010001"></uses-feature><br><br> <!-- Informs the app store what features are required or are optional for this app. --><br> <!-- Setting the telephony feature to not required allows this app to be installed by devices that are not phones. --><br> <uses-feature android:name="android.hardware.telephony" android:required="false"></uses-feature><br> <!-- Listens for Google Cloud Messaging push notifications and registration messages. --><br> <receiver android:name="com.ansca.corona.notifications.GoogleCloudMessagingBroadcastReceiver"> android:permission="com.google.android.c2dm.permission.SEND" &gt;<br> <intent-filter><br> <action android:name="com.google.android.c2dm.intent.RECEIVE"></action><br> <action android:name="com.google.android.c2dm.intent.REGISTRATION"></action><br> <category android:name="."></category><br> </intent-filter><br> </receiver><br><br> <application android:name="CoronaApplication"> android:label="Myapp"<br> android:hardwareAccelerated="true"<br> android:debuggable="true"<br> android:icon="@drawable/icon" &gt;<br> <!-- The main Corona activity that runs the Corona project. --><br> <activity android:name="com.ansca.corona.CoronaActivity"> android:screenOrientation="portrait"<br> android:configChanges="keyboardHidden|orientation|screenSize"<br> android:label="Phrases"<br> android:launchMode="singleTask"<br> android:theme="@android:style/Theme.NoTitleBar.Fullscreen"&gt;<br> <intent-filter><br> <action android:name="android.intent.action.MAIN"></action><br> <category android:name="android.intent.category.LAUNCHER"></category><br> </intent-filter><br> </activity><br><br> <!-- Other Corona activities that can be launched by the main Corona activity. --><br> <activity android:name="com.ansca.corona.CameraActivity"> android:theme="@android:style/Theme.NoTitleBar.Fullscreen"<br> android:configChanges="keyboardHidden|orientation|screenSize"<br> android:screenOrientation="portrait" /&gt;<br> <activity android:name="com.ansca.corona.VideoActivity"> android:theme="@android:style/Theme.NoTitleBar.Fullscreen"<br> android:configChanges="keyboardHidden|orientation|screenSize" /&gt;<br><br> <!-- Corona content provider required by the video player and mail app to access this app's local files. --><br> <provider android:name="com.ansca.corona.FileContentProvider"> android:authorities="com.mycompany.myapp.files" /&gt;<br><br> <service android:name="BillingService"></service><br><br> <!-- Corona service used to perform background operations such as managing notifications. --><br> <service android:name="com.ansca.corona.CoronaService"></service><br> <br> <receiver android:name="com.ansca.corona.SystemStartupBroadcastReceiver"><br> <intent-filter><br> <action android:name="android.intent.action.BOOT_COMPLETED"></action><br> </intent-filter><br> </receiver><br><br> <!-- Handles local/scheduled notification events. --><br> <receiver android:name="com.ansca.corona.notifications.AlarmManagerBroadcastReceiver"></receiver><br> <receiver android:name="com.ansca.corona.notifications.StatusBarBroadcastReceiver"></receiver><br><br> <!-- Listens for Google Play/Marketplace in-app purchase responses and notifications. --><br> <receiver android:name="com.ansca.corona.purchasing.GoogleStoreBroadcastReceiver"><br> <intent-filter><br> <action android:name="com.android.vending.billing.IN_APP_NOTIFY"></action><br> <action android:name="com.android.vending.billing.RESPONSE_CODE"></action><br> <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED"></action><br>	</intent-filter><br> </receiver><br><br> </provider></activity></activity></application><br></manifest>  
  

and then in my config.lua i have this:

  
application =  
{  
 content =  
 {  
 width = c\_width,  
 height = c\_height,  
 scale = c\_scale  
 },  
 notification =  
 {  
 iphone =  
 {  
 types =  
 {  
 "badge", "sound", "alert"  
 }  
 },  
 google =  
 {  
 projectNumber = "75355xxxxx",  
 },  
 }  
}  
  

and to collect the events, I have this in my main.lua:

[code]
– -> NOTIFICATIONS
local function onNotification( event )
fxpcall(function()
if(event.token ~= nil) then
notification_token = event.token – setting global for now :confused:
end
if event.type == “remoteRegistration” then
native.showAlert( “remoteRegistration”, event.token, { “OK” } )
elseif event.type == “remote” then
user.getUser(nil, false)
native.showAlert( “Alert”, event.alert, { “OK” } )
–native.showAlert( “remote”, json.encode( event ), { “OK” } )
end
end)
end

Runtime:addEventListener( “notification”, onNotification)
– NOTIFICATION END
[/code] [import]uid: 95944 topic_id: 34526 reply_id: 138197[/import]

You need to change the following tag…
[lua][/lua]
…to…
[lua][/lua]

Android does not accept permission strings starting with a leading period. That is a Corona Simulator feature which tells it to automatically prefix the package name, making it simple for Corona Simulator users. Google doesn’t make it so simple for native developers. This matches the settings that Google documents here…
http://developer.android.com/google/gcm/gs.html#android-app

Also, your “GoogleCloudMessagingBroadcastReceiver” has 2 mistakes.

  1. This tag must be inside of the [lua][/lua] tag, like how it is shown in the sample project’s AndroidManifest.xml file.
    2) Your [lua][/lua] tag is set up wrong. You cannot use a period ‘.’ for the name. It must be set to your app’s package name as shown in the sample project and in Google instructions (see link above).
    [import]uid: 32256 topic_id: 34526 reply_id: 138211[/import]

You sir, are a gentleman and a scholar.

Those fixes did it. [import]uid: 95944 topic_id: 34526 reply_id: 138325[/import]

Great! Josh knows his stuff.
[import]uid: 10668 topic_id: 34526 reply_id: 138329[/import]