Imaging/Cloning Android phones and Firebase Cloud Messaging - android

We are attempting to configure an Android phone with apps, etc and then create an Image so we can make many exact copies of this phone with all the configuration correct.
This works well, except we have found that Firebase Cloud Messaging thinks that Imaged phones are all the same phone and things get really messed up.
We have cleared the data for Google Play Services and our apps and forced stopped them all. This should of reset the GCM tokens, etc and created new ones but we are still having the issue.
How does Firebase Cloud Messaging create a device token (not app token) and how can we make the Imaging process work?

Related

Google Cloud Pub_Sub

Hello Everyone,
I have create gmail app and complete all types of functionality but one functionality not implemented this one is mail receive in our gmail app.
Me search any types solution for receive mail and i have found one solution is google cloud Pub/Sub but this pub/sub how to implemented in our app is not idea show please tell me any one how to used pub/sub in android.
Cloud Pub/Sub is not the right choice for receiving messages on Android. The service is designed for inter-service communication. Using it on Android would present two problems:
The limit on the number of topics and subscriptions per project. Only 10,000 topics and subscriptions are allowed and only 10,000 subscriptions per topic. If you plan to scale out to many devices, you will run up against these limits quickly.
Security/authentication issues. You would need to ship the credentials within the Android application and so you will either have to generate service accounts for every individual device or use the same one across all devices. What do you do if those credentials are compromised? In the former case, you have to keep track of all of them and revoke the right one. In the latter case, revoking the privileges means all of your devices stop working.
You need something like Firebase Cloud Messaging to send data to Android devices. You may use Cloud Pub/Sub as a means to generate notifications out of GMail, but the subscriber would be another server-side application or perhaps a Cloud Function that passes the notification on via Firebase Cloud Messaging.

Is it possible to store the text in push notifications from an android app (not owned by me) in Google cloud?

There is a free app available on Google's play store which sends push notifications to your phone when certain events occur ("news" events). I would like to be able to somehow store/scrape these notifications and eventually save them onto the Google Cloud platform.
The closest thing I have done to this is writing a python web scraper but I have never done anything with mobile apps and have no idea if this is even possible.
I tried googling but I only get results about sending push notifications to apps you have written yourself using Firebase. Any help/pointers in the right direction would be appreciated.
As far as I am aware, the only way to directly integrate Android App Notifications with Google Cloud Platform is through Firebase Cloud Messaging [1]. However the flow is in the opposite direction (from GCP to Android), and some dependencies need to be present in the Android App folders (like google-services.json file of the Cloud Project needs to be present in the App folder). For that to happen, you need to have ownership of the app.
You can use Google Cloud Storage on Android [2] to transfer the notification data / payload, but still you need to have an app for that.
[1] https://firebase.google.com/docs/cloud-messaging
[2] https://firebase.google.com/docs/storage/android/start

iOS app can't connect to Firebase IID service - Location Bound?

I am working on an app and the Android version implements Firebase for Instance ID, Cloud Messaging and Analytics. Everything is working properly in regards to obtaining the instance id and FCM token.
I also built a server API for sending notifications and data payloads to Android devices and in order to use the same methods in the iOS version I decided to use Firebase for iOS for the same purposes (Instance ID, Cloud Messaging and Analytics).
Setting up Firebase on iOS is well documented and I was able to set the environment for everything to work properly. However, when I run the app I got the following error in the console (which means that the instance id and FCM token were not retrieved):
....
[Firebase/InstanceID][I-IID003009] Failed to fetch default token Error Domain=com.firebase.iid Code=0 "(null)"
[Firebase/InstanceID][I-IID003007] Failed to retrieve the default GCM token after 5 retries
Wait, I know there are other people complaining about the same issue here but this is a totally different case.
I thought that my setup was incorrect or missing something but I reviewed all the procedures and code and everything was 100% correct.
Where I am located (Damascus, Syria), some services are blocked by Google and can only be accessible via a proxy or a VPN. Therefore I setup a US proxy for both the device I am using for testing and the simulator and when I run the app everything works properly and I was able to get the instance id and the FCM token and log them in the console.
What is weird is that in the Firebase Console the analytics is showing the correct number of users even when the FCM token was not received which means that the communication with the Firebase service is not totally blocked. The only part which is not working (without a proxy) is fetching the FCM token.
My question is: Why this particular Firebase service is blocked in iOS and not in Android and can I do anything about it? Remember that I have no problem in getting the token in Android from the same location. Or is this a bug in Firebase and the service is not location bound?
I have no problem in connecting to Google APIs from my location for other purposes like Google Maps or getting information about an FCM token..etc. However, I noticed that the console is referring to iid.firebase.com instead of iid.googleapis.com.
Any help or suggestion in this regard will be appreciated because I want to make a decision whether I should keep trying to use Firebase in both platforms or if I should rely on Firebase for Android and the native APNs ways for iOS. Also, I want to know if my decision to implement Firebase was the correct one in the first place.
Thanks!

Smooth GCM to FCM transition

Anyone have experience with it? I'm investigating migrating, but as we already have the app released with GCM, with thousands of users and thousands of notifications daily, I'm reluctant for fear of disrupting existing service. Did anyone manage a smooth transition?
Specifically, in the tutorial (https://developers.google.com/cloud-messaging/android/android-migrate-fcm) step one is 'Import Google Project'. Is this a one-way operation? Will existing GCM server solution and deployed GCM apps continue to work?
Or is the best bet to create a new project, and maintain two server solutions until the GCM deployed apps are phased out?
Importing your Google project into Firebase is a one way operation, however this is not a destructive operation, your current project will have required APIs turned on and necessary API keys will be generated for use with Firebase, but you can still manage that project from the Google Developer console if you decide not to continue using Firebase.
Your present server solutions will continue to work as before. I would go with importing your project to Firebase. It will be much easier than having to migrate your backend to a new project.
note:
If you were using pre InstanceID tokens for device IDs then they will not work in the Firebase console or with topics. So you would have to maintain a mapping of which users you can send to using the Firebase console and/or topics. If your were using GCM with InstanceID then there is nothing to do since FCM also uses InstanceID. You can use the FCM REST API to send to ALL tokens, InstanceID or pre InstanceID.
Be sure not to use GCM and FCM libs in the same client app. You can find issues when generating tokens and handling received messages.
First test out, There are many things to take care in FCM.
Major issues :
White Notification Icon while app is in background or killed.
App hangs after opening closing multiple times.
Read these issues to decide:
Firebase push notifications update DB
https://stackoverflow.com/a/37626817/1507602
How to handle notification when app in background in Firebase
After Upgrading to Google Play Services 9.0.0, App Hangs in DynamiteModulesC
Notification Icon with the new Firebase Cloud Messaging system

Android Messages - Development vs Distribution

Forgive me for not knowing the correct Android termonology. I come from an iOS background so I'm trying to learn how to do two things correctly in the Android world.
Control "Badges" for Android
Send "Push Notifications" via Distribution (production) vs Development.
Fortunately I found the answer to #1 which is to use Status Bar Notifications thanks to this question.
Now for #2. I already have a GCM setup and can send notifications out to all registered devices. However, sometimes I want to be able to send notifications to all user's phones, and sometimes only to "development" devices. With iOS this is distinguished by devices that have been downloaded from the App Store / Ad-Hoc environment (Distribution) and devices that have been physically plugged into a computer which complies the source onto their device (Development). Is there anything similar to this for Android?
There is no difference between development and distribution in Google Cloud Messaging. All the messages are sent from your server to the same GCM endpoint.
If you want to distinguish between development devices and non-development devices, you'll have to manage it on your server's DB (for each registration ID you store in your server, add a flag that says if it's a development device or not).
EDIT :
Actually there's something else you can do, though I'm not sure it's such a good idea. When the app registers to GCM, it supplies a sender ID (which is a Google API project ID). You can use two different project IDs for development release and production release. The registration IDs returned by the registration process are tied to the project ID. Now, when you send a GCM message from your server, you send it using an API key that is tied to a project ID. If you use the API key that is tied to your development project ID, only registration IDs which are tied to that project ID (i.e. they originated from devices that have the development build) will work. Sending messages with "production" registration IDs will result in MismatchSenderId error (which is similar to APNS in the way that sandbox device tokens are invalid in the production environment and vice versa). I'm not sure that's a good idea, because you don't want to rely on errors from Google for your logic. If you want to send messages only to a subset of your clients, you should manage this subset in your DB.

Categories

Resources