Rob,
Yes, I think because sample build.settings has “android.permission.GET_ACCOUNTS”.
Rob,
Yes, I think because sample build.settings has “android.permission.GET_ACCOUNTS”.
Rob,
Sorry to keep pestering you.
How is it afterwards?
I can’t get google’s registration ID on CoronaSDK…?
Hi @ozawa. I’m not sure what you mean by “How is it afterwards?” How is what?
Can you summarize please:
Your app on Android 4.1 and later? Registration or No Registration?
Your app on Android 4.04? Registration or No Registration?
Your app on pre-Android 4.04? Registration or no Registration?
What about JonJohnson’s app?
Also read this thread and see if it helps any: http://forums.coronalabs.com/topic/32904-android-push-notifications-registration-and-unregister/
Rob,
Sorry, my English is not good.
I want to know what I can get registration ID on Android version less than 4.0.4.
Can you get ID on their OS?
>Your app on Android 4.1 and later? Registration or No Registration?
I can Registration.
>Your app on Android 4.04? Registration or No Registration?
I can’t Registration.
>Your app on pre-Android 4.04? Registration or no Registration?
I can’t Registration. I checked Android 2.3.4.
>What about JonJohnson’s app?
It’s same. I can get Registration ID only on Android 4.1.4.
These devices I checked is installed Google Play and set up Google account.
I can be downloaded apps on these devices from Google Play.
I want to know whether you can get registration ID on on Android version less than 4.0.4.
Now that we have narrowed this down to it doesn’t work on certain versions, the engineers have tracked down a problem in the latest public build (1137) that prevented this from working pre 4.1 of Android. This has been fixed in 1151 and has been retro-fixed to 1137. You do not need to download 1137 again, just rebuild and it will pick up the changes from the server and back to Android 2.2 should work.
Again: Public 1137 users, just rebuild. Daily Build people, pick up 1151.
Thanks for your patience on this.
Rob,
I rebuilt and I can get registration ID on Android version 4.0.4 !
I appreciate your prompt response.
Thanks.
I also have a 4.0.4 and just rebuilt and it’s working as well! How fabulous is that?
Thanks everyone!!!
Jen
I just wanted to add one more reason someone might not get the remoteRegistration event. I am not using dynamic scaling and thus did not have the “content” setting listed in the config.lua. Once I added an empty content object to the list I started receiving the notification events.
I just wanted to add one more reason someone might not get the remoteRegistration event. I am not using dynamic scaling and thus did not have the “content” setting listed in the config.lua. Once I added an empty content object to the list I started receiving the notification events.
Hi all, I hope this thread is still open. I seem to have encountered this same issue on the most recent build of corona, 2014.2393.
I recently updated an app I launched last year, and it seems to have broken for several users pre 4.0.4 as mentioned above. I can’t figure out what to change (if anything on my end). Below are high level current implementations, build and configs. It seems to be working on many other Android devices, and I’m trying to get as much information from one of my users as possible as to why it isn’t working for them.
Implementation:
function onNotification(event) native.showAlert("GCM EVENT: ","EVENT: "..event.type.." Platform: "..system.getInfo("platformName") ,{"OK"}) if event.type == "remoteRegistration" then local deviceToken = event.token local deviceType = 1 --default to iOS if ( system.getInfo("platformName") == "Android" ) then deviceType = 3 end if(deviceType==1)then -- Apple registration elseif(deviceType==3)then -- GCM registration googleRegistrationId = event.token end end end Runtime:addEventListener("notification", onNotification)
Settings:
settings = { orientation = { default = "portrait", supported = { "portrait" } }, plugins = { ["CoronaProvider.ads.admob"] = { publisherId = "com.coronalabs", supportedPlatforms = {android=true}, }, }, android = { permissions = { { name = ".permission.C2D\_MESSAGE", protectionLevel = "signature" }, }, usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.GET\_ACCOUNTS", "android.permission.RECEIVE\_BOOT\_COMPLETED", "com.google.android.c2dm.permission.RECEIVE", "android.permission.C2D\_MESSAGE", "android.permission.ACCESS\_FINE\_LOCATION", -- Fetches location via GPS. "android.permission.ACCESS\_COARSE\_LOCATION", -- Fetches location via WiFi or cellular service. }, usesFeatures = { -- If you set permissions "ACCESS\_FINE\_LOCATION" and "ACCESS\_COARSE\_LOCATION" above, -- then you should set up your app to not require location services as follows. -- Otherwise, devices that do not have location sevices (such as a GPS) will be unable -- to purchase this app in the app store. { name = "android.hardware.location", required = false }, { name = "android.hardware.location.gps", required = false }, { name = "android.hardware.location.network", required = false }, }, }, iphone = { plist = { CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-72.png", "Icon-72@2x.png", }, UIAppFonts = { "LiberationSans-Regular.ttf" }, UIApplicationExitsOnSuspend = false, UIStatusBarHidden = true, }, components = {}, }, }
Config (note, just one of several potential configs):
else print("CONFIG----6") application = { content = { graphicsCompatibility = 1, width = 320, height = 512, scale = "letterBox", xAlign = "center", yAlign = "center", imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, notification = { iphone = { types = { "badge", "sound", "alert" } }, google = { projectNumber = "xxxxxxxxxxx" } } } end
Bump?
While I’m not an Android expert, you do have a difference in your build.settings from our sample app which is known to work. These are the permissions from the sample app:
usesPermissions =
{
“android.permission.INTERNET”,
“android.permission.GET_ACCOUNTS”,
“android.permission.RECEIVE_BOOT_COMPLETED”,
“com.google.android.c2dm.permission.RECEIVE”,
“.permission.C2D_MESSAGE”,
},
Note the last one does not have com.google.android on it nor android. Perhaps you could try the permissions as specified above and see if that addresses your issue.
Rob
Ok thanks Rob, going to try that and see if it works. Out of curiosity, why isn’t that consistent?
I have no idea. I don’t know Android native behavior well enough to know if this is a Googleism or not.
Rob
Hi, I can get Android registration key(device token) but i can’t iphone device token.
Do you have any idea?
I can’t get any notification event.
local function notificationListener( event )
native.showAlert( “Alert”, “I can’t get any event”, {“Ok”} )
if ( event.type == “remoteRegistration” ) then
native.showAlert( “Register”, event.token, { “Ok” } )
elseif ( event.type == “remote” ) then
--handle the push notification
end
end
–The notification Runtime listener should be handled from within “main.lua”
Runtime:addEventListener( “notification”, notificationListener )
Below is my config file content.
application = {
content = {
width = aspectRatio > 1.5 and 320 or math.ceil( 480 / aspectRatio ),
height = aspectRatio < 1.5 and 480 or math.ceil( 320 * aspectRatio ),
scale = “letterBox”,
fps = 60,
imageSuffix = {
["@2x"] = 1.5,
["@4x"] = 3.0,
},
notification =
{
iphone =
{
types = { “badge”, “sound”, “alert” }
},
google =
{
projectNumber = “1039916599XXX”
},
}
},
}
I’ll check my configuration and initial code later, but did you setup dev cert for push notifications and enable in Apple developer?
Sorry, There was issue in config file.
As you can see above, notification tag should be same level with content below application.
I have just seen that after post
Did you get it working?