Android c2dm push notifications after app reinstall - java

I have the following question:
I've successfully implemented C2DM in my application. I'm registering to both google c2dm cloud and a custom server that "creates" notification contents. Everything is working fine.
My question is : what happens when i uninstall my app and then reinstall it on the same device? I've noticed that C2DM is sending me back the same app_key, so apparently there's no way to determine my app installation status change. And i keep on receiving old push notification (they're customized by user preferences in the app).
I won't be able to test with a google play published app until final release, so i would like to know if there's a chance that google itself could notify c2dm that the app was uninstalled on my device and force it to change my app_id at next restart.
Thanks in advance
Stefano

From what I understand in C2DM, you shouldn't depend on Google's registration ID by itself. They "promise" nothing - you might even get a new registration ID without a clear reason (might be their own vrsion upgrades, etc.).
If you want to follow installation - you should do it with your own server - create a unique identifier whenever the app asks for registration, and use it and not the Google's registration ID.
Regarding to Google Play - couldn't find a difference between published app and unpublished one - the behavior seems to be the same.
Hope this helps somehow.
Shushu

Related

App Links on Android with the app not installed

I am trying to implement app links into my app to make sure that other malicious apps cannot register for my URL.
I read the guide on app links here https://developer.android.com/training/app-links/verify-site-associations.html and I have mostly understood it. But one thing which is not clear to me is how can I prevent malicious apps from receiving my domain links if my app is not installed.
Consider this scenario.
1. My app is not installed on the user's device
2. Some malicious app is and it knows the URL that my app handles
Wouldn't this launch the malicious app and it can intercept my URL if the user selects that app from the disambiguation dialog? Is there any way to prevent it?
I understand that android:autoVerify="true" will trigger the domain verification when the app is installed, but what if the app is not installed?
Whether the user has the app installed or not, the "illegal" app won't be able to handle your links since it has not access to your domain in order to save there the needed JSON file. Am I clear?
There is a JSON file that is required during App Link configuration, that has to be uploaded to your server (that includes your app ID), through which your web-app basically says to the Android OS 'this is my counterpart on Android devices, I authorise it to handle these URLs'. Since app IDs are unique, there is no way another app can meet those conditions.
To quote the docs:
An Android App Link is a deep link based on your website URL that has
been verified to belong to your website.
So, although an app may register an <intent-filter> it ALSO has to be verified by the website whose URL it's trying to handle. And this happens on the server, so, out of the reach of a mobile client.
See also HERE for a more detailed explanation.

Can I force my Android app to update from the Play Store?

I fear my users will ignore my latest app updates if they don't think they're necessary.
The app is downloaded from the Google Play store, is there any way I can force updates of my application?
In addition to the solution that Gabe Sechan suggested, now you can use the Google Play In-app Updates feature.
The user has control of whether to enable auto-update or not. You cannot force them. If the app has no server interactivity, there's nothing you can do. If the app does have server interactivity, send the version up with each request, and if the version is too low send an error response back. The client should then interpret that error response and show a "Must update" screen

Firebase Cloud Messaging not working on some devices

I have a problem with sending push notifications from server via FCM.
So at first everything was working fine after adding push notifications.
I had to change the package name of an android app so I added new app on Firebase with new package name and I have downloaded new json file, and changed the name in manifest file and gradle.
After doing it, I noticed that on some smartphones these notifications aren't working and on others they work :/
When I'm using only Firebase to send push notification (the firebase console) - it works. But when I receive the push notification from server on one phone, on another I don't.. I am updating the regId in my database and all notifications on my phone are turned ON. I thought that maybe the problem is that I have 2 apps in one project in firebase, so I made new project and again downloaded json file but it is the same as earlier.
Have anyone had this kind of problem or anyone knows what could solve it and make it work again? :/
Really depends on device you were trying it on.
if the google play services is out of date you could try updating it from playstore.see if that fixes the problem.
if it has no google api/Playstore (so no amazon products and some none market devices)
push messaging does not work along with authentication. The realtime Data base still works but fires off an error in logcat.
ive been pulling my hair out for weeks trying to figure it out.. thought it was my code.. so i sent the firebase team a email to ask. They confirmed that there was no fix for this at the present time.. hope this helps

Android GCM Registration is failing

I am working on Google cloud messaging service in my android app. For this I need to register my android app to GCM server.
The gcm registration is failing.
I have checked:
The gcm register code is Async call.
The sender id (project id) is correct.
The manifest file is as per the google doc. http://developer.android.com/google/gcm/client.html
My device has google account set up.
I have tried both the cases - add google-play-services jar and import it as project.
I even went on to specify the version number (com.google.android.gms.version) in manifest as per this http://developer.android.com/google/play-services/setup.html#Setup
Where and why would this be failing?
When I catch the exception, exception cause is NULL.
I had done a demo app for this GCM part and it was working fine. I had used Eclipse with JellyBean SDK.
I extended this project to make the current app - package stucture remains same. But now am on Kitkat SDK.
I used the same Sender Id as before to register with GCM. It failed giving null id. I created new project at cloud console and used its project number as sender id. Still same error. Registration Id is null. I don't think Sender Id should be any issue.
Any help would be appreciated.
So is GCMRegistrar Class giving out, that it failed to register?
i think it could be your Manifest file - check everything correctly until you are really sure you did everything right.
I had an other problem when i implemented GCM into my Project. It was giving out "Regestration OKay" but the REG_ID from GCM Server that i needed to read out, was giving me an Empty (not NULL) it was empty LOL.
I moved my MainActivity (where the regestration happens) in the "original" package of my project and it worked.
please follow Push Notification via GCM
if key for browser apps doesn't work, then create key with ip locking and replace it into your config.php file, it will sure work.
please also check whether your client side code works properly or not on this site
I am getting the GCM Registration Id now. I made two changes.
Removed debuggable=false from Manifest file. Wrote a code in the activity to check for version of Play Store.
So conclusion, it was the issue with play store version may be.

Pushing response from Server into Client in android?

i am developing an restaurant menu app in android for Samsung galaxy tab. On my app user will select the food item and user will place an order. The list of items to be served is dispatched to the server through SOAP service. Now as soon as the the order get placed from the kitchen i want to notify the user that an order has been dispatched.
What i got while searching is that i can use PUSH Technology i.e. C2DM Cloud to Device Messanging. But i had not got proper code to use this in my app. Can any one give me a proper implementation of C2DM in android?
There are many push technologies. Another option is to use XMPP, as it will work on Android.
You can check Smack and asmack for XMPP. The asmack project is an Android specific derivitive of Smack, although there are people using Smack directly as well.

Categories