Android: Firebase Message service and google play services - android

I'm working on an android device which runs 5.1.1, and it's rooted. My plan is to implement firebase message service in the application I'm building which should run on the device. But initially It didn't have google play services so I installed in manually with 11.7.44 version. But the problem I'm getting now is, it doesn't get the firebase token still; I'm getting the following message:
FirebaseInstanceId: background sync failed: AUTHENTICATION_FAILED
Note that the device is connected to the internet, and also the program runs perfectly on normal android phones.
I'm suspecting whether I should install some other applications in order to run FCM correctly.
any ideas on that?
Thanks.

Related

Is there any effective way to test an app for the Huawei Store using Android Studio emulator?

I would like to know if there is any effective way to test an app for Huawei Store using an Android Studio emulator.
I tried disabling the Google Play Services, but for some reason Retrofit requests stopped working :/
You can use Cloud Debugging of AppGallery Connect to test your app for Huawei Devices.
Cloud Debugging tests your app using mainstream Huawei devices provided by Huawei. You can run your app on the latest and most popular Huawei devices to test app functions.
Work with Cloud Debugging
Sign in to AppGallery Connect and select My projects.
Select an app to be tested.
Go to Quality > Cloud Debugging.
Filter devices by Series, Android version, EMUI version, and Resolution.
In the Apply for device model dialog box that is displayed, set Debug duration based on your needs. The options are 30 min, 1 h, and 2 h.
Wait for the device initialization to finish.
Click the Debugging tab.
Click Upload to upload an APK.
Check the APK upload progress and install the APK after the upload is complete.
In the displayed dialog box indicating that the app is being installed, click OK. When the installation is complete, you can see the app icon on the device screen on the left.
Operate the device by moving or clicking your cursor on the device screen, or clicking the power button, home button, menu button, or back button. The device will respond like your own phone.
Check Screenshot below:
You can check out the official documentation for a more complete answer.
For most cases, you can simply grab HMS Core APK and install it on emulator or physical device
You do not need for most cases Huawei device. Here is my battle-tested solution.
If you're implementing HMS (Huawei Mobile Services) feature like push notifications, sms retrieving or auth(orization) you can do simply:
Grab HMS Core APK from: https://www.huaweicentral.com/download-the-latest-huawei-mobile-services-apk/
Create new or run existing Android emulator via Android Studio or ADB
Install HMS Core APK downloaded from 1.
Go to Settings -> Apps & Notifications
Make sure that HMS Core has required permissions like SMS for SMS retrieving or push notifications
If you forget about 5., HMS library will return exception "Permissions not enabled"
I am pretty sure that instead of emulator you can use any of physical devices, grab APK and install HMS Core on it.
From: https://stackoverflow.com/a/63790263/4730812
Happy coding!
Well, I was trying here to make Retrofit work in this condition and I found a way.
I don't know if it is the best solution, but I will post it anyway.
disable the Google Play Services;
force stop your app;
restart the emulator;
check if it is working now (if not, try to force stop your app again).
P.S.: Google Play Services is not re-enabled upon reboot.

FCM background sync failed: AUTHENTICATION_FAILED

I tried to get real time notification on Android using FCM. When I try running my app using emulator, notification message appear correctly. but when I try it on real device (xiaomi redmi note 3), the notification doesn't appear. The token always return null, and I get this error:
FCM background sync failed: AUTHENTICATION_FAILED
I've been to try read all same problem, there are 2 reasons why the problem appears:
Device not have Google Play Services
No internet connection
but I'm sure that my device have Google Play Services and is connected to internet, but the problem still exists.
How can I solve this problem? Any suggestion would be appreciated.
i've been solved this problem btw. the problem appear because my device error sync with google acoount. so i try to re-login my google account and make sure that sync google isnt error then the problem was fix :D

Google Cloud Platform Android example app not working on real device

I'm trying to run the Google Cloud Platform Android app example, it' s a cloud guestbook app.
Later in the tutorial, it uses the Google Cloud Messaging to live update the guestbook as new messages comes.
So i runned a new emulator with Google and try the app to see if it works.
When i write a message on my real device, the emulator get update in few seconds, But when i write a message on the emulator the real device don't get update at all.
My real device run android 4.4.2 but it's a custom rom.
Here a screen when i run the app:
I think that the yellow triangle inside the Target means something, but i'm not sure of it because the Google Cloud Messaging should ever works, i mean, how can i use Whatsapp and similar apps?
Thanks for help!

testing google backend engine on phone

I have an existing android app to which I plan to add Google cloud engine backend. I am following the steps as here
https://developers.google.com/eclipse/docs/endpoints-androidconnected-gae.
I used the option "Google-->generate app engine backend" by right clicking on my existing project. and then went forward to test this.
I started the devapp server( I can see it running at localost:8888/_ah/admin/datastore). However When I run my application, I don't see the device registered in the 127.0.0.1:8888. The application runs as it used to run before. I tried both on emulator and on phone but the application just runs as before but I don't see any device registered in my devappserver.
Am I missing anything here?
Some basic steps for application registration were missing in my application. http://developer.android.com/google/gcm/gs.html
Adding them now and that should solve the problem.

Device cannot connect android market

My app have purchase in app, but when i run the app, disappear an alert with content "This app cannot connect to market. Your version maybe out of date. You can continue to use this app but you won't be able to make purchase".
My devices is installed Google Play 3.5.15, and also connect internet. I have ran my app in another devices, it's ok. Can i tell me why, what solution?

Categories

Resources