I cant get Android Push to work with ionic. (ios works by the way)
I followed the documentation here:
http://docs.pushwoosh.com/docs/cordova-phonegap
I even tried to create the same sample app based on this:
https://www.youtube.com/watch?v=-P2O1jmb7fI
And it does not work on Android (ios works though).
I configured PushWoosh and the app something like below:
Application code: XXXXX-XXXXX (formatted hex appcode id)
google server key: 123456789012345678901234567890123456789 (39 hex key)
google project number: 123456789012 (mine has 12 digits)
GCM API is enabled
I can see in the PushWoosh there is Android device registered, but why
cant I receive the push ? Is there something i need to do on phone,
code, etc ? I even try to put breakpoint into addEventListener but nothing received.
Really need Android to work with Push Notification. Thanks!
I am using device:
Redmi Note 2
Android version 5.0.2 LRX22G
Didnt also work with emulator:
Android 5.0.2
Build number: sdk_google_phone_x86-eng 5.0.2 LSY66D 1797986test-keys
PushWoosh response (will update when I'ved recreate new keys for these):
As far as I can see in your Push History, there are some "Unauthorized" errors. There are three possible scenarios why you are getting the "Unauthorized" error:
The Google Project number in your application isn't the one in Google Console;
The API key in your Control Panel isn't the same that you got in Google Console;
The API key, for some reason, doesn't work properly.
Could you please check whether your Google Project number and API key are fine?
Also, could you please try using the Browser Key instead of the Server Key and vice versa?
That's the correct answer for these kind of errors. Please make sure you Google Project Id is the one that matches the Server Key. Also make sure you did not set any restrictions or white-listening on the Server Key.
Check this article on how to find Google Project Id:
https://support.google.com/cloud/answer/6158840?hl=en
The problem was that i didn not enable GCM in the correct project. Was always assuming the primary project api enabled works for all.
Related
I am trying to get push notifications working with my cn1 app for android. I have it working perfectly on ios but for some reason for android it's not even registering. This is what I did
I started a new project in my play store console, input the app name and package name.
I then went into my google cloud console and generated a new api for my app and enabled GCM. This gave me a server key, project id (which was only 4 digits) and a project number.
I then try to register for push in my app using this code:
Hashtable meta = new Hashtable();
meta.put(com.codename1.push.Push.GOOGLE_PUSH_KEY, XXXX);
Display.getInstance().registerPush(meta, true);
For push key, I entered the 4 digit project id given to me in the cloud developer console. I then created a KeyStore for my app and sent it for build. However when I use the app it does not fire register for push and the device id is null. I have included the build hints android.playService.*=true only. I also tried to include both android.includeGPLayServices and android.playService.*, and it still didn't work. What am I doing wrong? Is my project id supposed to be 4 digits. in examples online they appear to be longer than 4???
See the developer guide section https://www.codenameone.com/manual/appendix-ios.html#push-bureaucracy-android-section
You need the sender id:
I am trying to create a map app with the GOOGLE API, for use on android devices, but I'm fairly new to this so have been following tutorials to get me started. I fixed my initial problem, however another one has appeared and I can't find what's wrong / how to change it!
When running the app through a mobile, it loads onto the phone fine, a screen loads (the sort of beige colour you see when google maps is loading) as well as the logo and zoom controls. But stops after this and displays the following error in LogCat:
Authorization Failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
Ensure that the following correspond to what is in the API Console: Package Name: com.example.myapp, API Key: [my api key], Certificate Fingerprint [my code]
Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
I have completed the steps on the link and checked my code and made sure all those details match, but it's still not working.
This is probably a very basic error, but how would I go about resolving this / Am I looking in the correct place?
[Code no longer here; had to delete it]
If you run the app through Eclipse with a USB connected device, you need to use the MAPs debug key. If you export the app and load the .apk on a device, that app would have to be compiled with the production key.
Last resort: uninstall and re-install app. Clean and rebuild the project is also a good idea
Moreover, please make sure your API key was an Android key, not a browser or server key. Also check that the service is Google Maps API for Android V2, not Google Maps JavaScript API V2.
If you still get any problems, check your set-up against the top answer in this question: Google Maps API V2 - always get authentication error.
I have been working on GCM Push Notification for my upcoming project and I have been facing several confusion regarding its implementations. I have followed the following links:
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
http://developer.android.com/google/gcm/client.html
The implementation that I ended up with works quite fine with the emulator(not on all of them). Here is a link to my registration implementation.
It works fine with an emulator running on platform 4.2.2
It isn't working with an emulator running on platform 2.3.3
My experiences so far tells me that, on the client side, the following things must be ensured to enable GCM properly:
Google Play Services installed
The device synced with a Google account.
Am I right?
So I have the following questions to ask:
What are the client side dependencies that I should be worried about while implementing GCM? What should I check in my code?
When I uncomment the lines from 110 to 114 in the above code to check play services, I receive the following error log http://pastebin.com/C2BJkiyt . But it still allows me to register. What's wrong?
When I run the working code(working on emulator) on a real device having Android 2.3.6, it doesn't work. It also doesn't work on a device having ICS.
Thanks for the time.
You are registering to GCM with the deprecated library method GCMRegistrar.register. This can still work, but it requires on pre-4.0.4 Android devices with a logged-in Google account.
Google encourage you to stop using the deprecated library, and instead use the register method of GoogleCloudMessaging class, which doesn't require a Google account even in older Android versions. See their GCM Demo for an example.
The code that checks for play services is only relevant if you switch to the new registration method.
As for why the deprecated registration method doesn't work for you on some devices, you'll have to include the logcat to get help with that.
I'm trying to implement Google Play Services following Google's documentation and I'm seeing the following when I try to connect my GameClient:
E/Volley: [4953] il.a: Unexpected response code 401 for https://www.googleapis.com/games/v1/players/me
E/Volley: [4953] il.a: Unexpected response code 401 for https://www.googleapis.com/games/v1/players/me
E/SignInIntentService: There is no linked app associated with this client ID.
I've checked that the SHA1 fingerprint of the certificate signing the APK, the SHA1 of the debug certificate, and the SHA1 given to the Google API do match up and they do. I've checked that the app id is declared in the manifest in the application item (I've taken in my case the 13 digit numerical id, not one that also includes a package). I've also checked that the test accounts I'm using are each listed in the Developer Console and they are; they're each #gmail.com too, and they include my developer address. They've each activated Google Plus.
I've tried this from an API 16 S3 device and an API 17 Google API simulator. The app's package name is correctly declared in the manifest, on the developer console and matches the API package name. The app is listed as a client of the game service, and is shown as 'ready for testing'.
In short I'm struggling to see what my mistake can be and what I've missed. I think I have everything from Google's troubleshooting addressed too. I've looked at the main questions here on StackOverflow, and they're covered. Whatever it is I'm missing is probably staring me full in the face. What can I be missing?
I got stuck on this problem for a long time until I realised that I had two strings in my app called "app_id". One from the Facebook SDK and one from Google. I renamed the Google app_id (and changed the corresponding manifest reference) and all was well.
It is POSSIBLE that you have a similar problem. If you can't see the error then I would try to write out the app_id to syslog to confirm that this is not the cause of the problem.
Incidentally, all my Google app_id s (client ids) are 12 bytes not 13, so perhaps you should start by checking that.
Good Luck !
Even after redoing everything, everything, I still encountered the same problem. However, I subsequently encountered a "This package is already in use" error message on Google API even though I had undeleted all projects and removed all clients before deleting these again.
This turned out to be a blessing: The solution to this was to recreate my debug key before adding the new fingerprint to Google API in another new client id.
And lo... my original problem went away.
I hade the same problem and for me it worked to re-link the app in Game services -> Linked apps -> Link another app.
You didn't explicitly state that the gmail accounts you're testing with are added as Google Plus users in a Google Plus community that is configured as the testing community for your app -OR- that you're using a google group as the testing community and those gmail accounts are part of that community.
If you have done those things, then it might be the issue stated here:
https://code.google.com/p/google-plus-platform/issues/detail?id=554
This answer might sound encouraging to solve your problem, but don't get your hopes up. I've done all that the original poster did, plus the things above, and I'm still stuck.
I've even followed all of the tips stated here:
Google Play Game Services - unable to sign in
And it would appear the depths of the chasm that Google lets you fall into regarding GPS is far deeper than the depths I've plumbed. Joy.
I had the same problem ,I am not sure that the following action is the one that resolved the problem but its worth the try,
Seems that I didnt had the Drive API enabled ,I had it in the enabled apis but i had to actually click the gear icon next to it and then click enable and provide the application name.
Just link the same package as many times as you have Client ID's in your Developer Console "Debug & Release Client ID's"
The thing is if you link your app to the Game Services with the wrong SHA1 fingerprint, Games Services will pick it up and associate it as the main Client ID.
Once you link the same app again to your Game Services, it will automatically pick up the other Client ID's
I had exactly the same problem, and in my case, I fixed it regenerating the API Key from the Google APIs Console. Go to Credentials, select your API key and then click on "Regenerate Key". You don't need to update anything in your code or link more apps, just regenerate and it starts working magically.
I followed the same steps that are mentioned in the "Android Cloud to Device Messaging (C2DM) - Tutorial", downloading the source code for the project and customizing it for my purpose (changing the package name and role e-mail sender).
Unfortunately I get an error message stating:
"Unable to start service Intent
{act=com.google.android.c2dm.intent.REGISTER ... }: not found" in logcat.
Knowing that I have added a Google account to the emulator which is different than the one I used when signing up on the service in the first place.
Can anyone provide help or direction in how can I get the registeration key correctly setup and solve this problem?
I think I figure the solution for my above question which is, you have to create new AVD using android AVD manager that its target Google APIs either level 8 or 15 or whatever, not using android API.
and also you have to have google account that added to your emulator which is the role e-mail that you used in development process of your application.
I hope that solve all problems faced other developers regarding this issue.