I don't get "remoteRegistration" Event

Hey guys,

I try to implement GCM.

But I don’t get “remoteRegistration” Event.

I read this page.

http://www.coronalabs.com/blog/2012/12/25/corona-holiday-gifts-android-push-and-more/

I try to execute Sample Code Notifications/GooglePushNotifications set projectNumber.

But I didn’t.

In same source code,iOS is OK.

I can get iOS’s device.token.

Could you tell me,the point that I should check.

thanks ,

ozawa

can you post your build.settings and config.lua?

Thanks Rob. My project’s build.setting and config lua are as follos.

build.setting

settings = { orientation = { default = "portrait", supported = { "portrait", } }, iphone = { plist = { UIStatusBarHidden = true, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend -- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "----myFacebookUrlScheme-----", -- example scheme for facebook } } } } }, android = { permissions = { { name = ".permission.C2D\_MESSAGE", protectionLevel = "signature" }, }, usesPermissions = { "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.INTERNET", "android.permission.GET\_ACCOUNTS", "android.permission.RECEIVE\_BOOT\_COMPLETED", "com.google.android.c2dm.permission.RECEIVE", ".permission.C2D\_MESSAGE", "android.permission.BIND\_REMOTEVIEWS" }, }, }

config.lua

application = { content = { width = 640, height = 960, scale = "letterBox", fps = 30, --[[imageSuffix = { ["@2x"] = 2, } --]] }, -- Push notifications notification = { iphone = { types = { "badge", "sound", "alert" } }, google = {projectNumber = "----myProjectNumber---"} } }

in actuality, I set projectNumber I got Google Apis.

Do you need these permissions? 

“android.permission.ACCESS_NETWORK_STATE”,
“android.permission.BIND_REMOTEVIEWS”

Have you looked at the console log (adb logcat) and put in some prints to see what’s happening?

>“android.permission.ACCESS_NETWORK_STATE”,

>“android.permission.BIND_REMOTEVIEWS”

These may not need…

I deleted these permissions.

But I don’t get “remoteRegistration” Event , yet…

I check ddms log.

I can’t found it like a trouble cause.

if Notifications/GooglePushNotifications sample is not move,

I have mistake Google’s set up?

I wrote main.lua as follows.


-- notification listener local function onNotification( event ) if event.type == "remoteRegistration" then native.showAlert( "send", event.token, { "OK" } ) elseif event.type == "remote" then native.showAlert( "remote", json.encode( event ), { "OK" } ) end end Runtime:addEventListener( "notification", onNotification )

Everything looks like it’s right.  I’m not sure what could be the cause.  There should be something in the logs.

I am also having the same problem.

My logfile shows the following error:
I/AppSecurityPermissions( 7815): Ignoring unknown permission:nl.questo.development.SampleBlank.permission.C2D_MESSAGE

I can see the packagename “nl.questo.development.SampleBlank” has been automatically inserted

Im using the debug keystore for building the project

Rob,

I checked launchArgs but no “notification” property.

It maybe same case as below.

http://forums.coronalabs.com/topic/35139-corona-cloud-push-notifications/?p=182695

What properties are correct…?

launchArgs may not be set depending on the state of your app when the notification is interacted with.  launchArgs will only be set if your app is not running.  I don’t mean backgrounded.  I mean stopped, not in memory.  If you start your app by tapping it’s icon, launchArgs.notification won’t be set.   If you tap the notification and the OS starts your app code, then you get launchArgs.notification.  I’ve been testing it and it works (both on my Nexus 7 and my iPad 4).

If your app is in memory (in the foreground or background), launchArgs will not have a notfiication event.  Your app will however receive a notification event through the event handler and that event table will hold the notification content.

Thanks, Rob.

I understand the case of getting launchArgs.notification.

It’s when I tap device’s alert or notification, isn’t it?

Then, when can I get notification event that type is remoteRegistration?

I want to get Registration id, so I should get notification event.

Can you get notification event that type is remoteRegistration when launch your app?

And,

In My google API’s console Dashbord, 

Google Cloud Messaging for Android status is “No known issues”, is this no problem?

Did you ever figure this out? I’m seeing the same issue, my Android device isn’t ‘talking’ to GCM; e.g. I don’t see a print statement or alert after the remoteRegistration event, which seems to mean it’s not happening at all, and I see no activity for my Android device in the GCM console. Any solution?

jen,

Probably, My case is same your case.

My device get push notification from other apps.

My game needs Push notification,I am very troubled…

Rob,

Please tell me your CoronaSDK version.

I use Build 2013.1137.

I have this working OK, I can make a bare minimum GCM registration project, verify it works and send you guys. I think you probably tried everything but if you think it might help?

If you could post it on github I’d be grateful. I feel it’s either my Google setup or this dumb phone. Can you tell I am an iOs dev? :slight_smile:

Thanks jonjonsson.

I tried to create app by Android SDK use Google Cloud Messaging for Android Library, then I got Registration id.

I want to see your code, too…

Are your code same “Notifications/GooglePushNotifications” sample?

This is almost certainly a configuration problem.  There are multiple people who have it running, this code as been stable for months. 

Do you have Google Play installed on the device?

I can’t see your google setup.  I’ll investigate today and see if I can see any setup gotcha’s on their side.  There is nothing other than running your app and making sure you have the event listener running that would prevent you from getting the remoteRegistration event.

Yeah, I know. I do have Google Play on my newer Samsung SII phone, but that phone is not activated and I wonder if I need to get it on the Sprint network to properly talk to Google. I wasn’t excited about buying another data plan for a phone I’m not going to really use except for testing. I’m an iOs chick :wink:

Here is Corona project with bare minimum you need to get deviceID so less chance of mix up.

Also included compiled .apk file from that project that you can put on your device to test. (using my GCM, I promise I won’t spam you :slight_smile: ). If my apk file works and your apk from same project does not, I guess its overwhelming chance of cloud configuration problem. If my apk does not work, it is probably a device problem.

Only change you have to make is to Project number in config.lua.

https://dl.dropboxusercontent.com/u/45955/AndroidDeviceID.zip

ps. APK built using 2013.1142

It this is not working for you, please make sure you re-read this:

http://www.coronalabs.com/blog/2012/12/25/corona-holiday-gifts-android-push-and-more/

Make sure in your config.lua that your projectNumber is in quotes.  Make sure there are no funky characters like a space that sneaks into your app.

Visit the Google APIS site, find your project, click on services and make sure your GCM is on.

I would also like to see your registration handler function and your  code to enable the listener.

For what it’s worth, there are no changes to Google Push that I’m aware of in a while.  The latest daily and the latest publich should be the same here.

Thanks jonjonson, Rob.

I tried apk as bellow.

https://dl.dropboxusercontent.com/u/45955/AndroidDeviceID.zip

I got registration id Android OS 4.1.1.

But OS 4.0.4, 2.3.4 did not get it.

Only in Android OS 4.1 or higher, CoronaSDK I can get the Registration ID?