Android Virtual Device for Huawei Mobile Services - android

I want to apply HMS to my app. However, buying an actual Huawei phone is not on my shortlist. Does Huawei provide an Android Virtual Device for that purpose? If not, how to test if my implementation of HMS actually works?

Yes, Huawei do provide an Android Virtual Device called 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. Besides, you can debug apps on two real devices at the same time using one HUAWEI ID. Assume that you have applied for a device successfully.
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:
From: https://stackoverflow.com/a/63389096/13329100

If you don't have HMS device your side you can run HMS Application in three ways.
1. Huawei Cloud Debugging in App Gallery: In this method first we have to sign in App Gallery. You can see the article "Efficient integration of HMS open capabilities by using HUAWEI Cloud Debugging solution" for the step by step process of cloud debugging.
2. Cloud debugging through HMS ToolKit: Here first we have to install HMS Tool Kit plugin in Android Studio.You can use the article "Debug your application on any HMS Supported Model using HMS Toolkit Cloud Debugger - No Real Device Required" for step by step process.
3. Installing HMS Core App in your non HMS Device: You can install HMS Core app in your non HMS device. Once install it will ask to update the app. This will help you to run some Kits like awareness, ML, Ad etc in your device. Once we install we have to go to Settings->Apps and search for 'HMS Core'and grant the location or other permissions which are required.
Hope any of these method will help you.

Related

Can't use huawei mobile services on the new Huawei devices

I'm developing an android project.I want to integrate Huawei mobile services for Huawei devices without google play services. in this project I have developed but when I test it for Huawei P40 in cloud debugging environment, Huawei mobile services don't work.It works when i test it on Huawei mate 10 pro.Huawei mobile services location kit not reacting at p40. How can i solve this please help me
Update:
I got the following message in Logcat. Message is; I/Last Location:
Last location is null!
Please check whether getLastLocation obtains location information from the system cache. If it does, the obtained location is null when the system cache has been cleared. In this case, call requestLocationUpdates to cache the current location. Then, you can obtain the location information by calling getLastLocation.
Here is the HMS Core Location Kit demo on github here. Please update to the latest version :)
Please ensure that the location permission has been assigned to the HMS Core app. Go to Settings > Apps > Apps and find the HMS Core app. (The menu path may vary depending on the operating system version. If you cannot find the app, tap the menu icon in the upper right corner of Apps and tap Show system processes.) Then, tap the HMS Core icon, go to App info > Permissions > Location, and verify that the location permission is assigned to HMS Core.
You probably cannot use the high-precision location service as it is currently supported only on HUAWEI P40 series and is available only in the Chinese mainland.
Activity identification and geofence are not supported on emulators.
If the error persists, please provide us with logs of the fault.
You can perform the following operations to capture the logs:
1). Run the following command to connect to the device
adb logcat –v time > D:\hwlocation.log
2). Reproduce the fault.
3).Press Ctrl+C.
In addition, record the device model, EMUI version, HMS Core version, integrated SDK version, and fault reproduction procedure so that technical personnel can help you quickly troubleshoot the fault.

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.

Import contacts from google account to Android Emulator

I'm using the Android Studio emulator, specifically a Pixel 2 emulator running Android 7.1.1 with Google APIs.
In my team we have a Google test account that has all sort of contacts that are useful for us for development and testing.
I have connected the emulator to this Google account (by going to Settings -> Accounts -> Add account -> Google) however I'm still unable to see the accounts associated with the Google test account in the device's "Contacts" app.
I've looked in account page and made sure that the syncing for "Contacts" is toggled on. I even tapped on "Sync now" but still I don't see any contacts in the "Contacts" app.
For comparison, we also have physical test devices in the team that are connected to this Google test account and there it works fine - the contacts are synced to the physical test device. So it seems to only be an issue with the Android Studio emulator (on GenyMotion emulator it also works).
How do I fix this issue?
I've attached two screenshots, one for the contacts app and the 2nd one for the Google account page.
In the 2nd screenshot there is a refresh icon appearing next to contacts, but no matter how many times I perform "Sync now" it doesn't disappear.

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!

Android LVL not accepting license on emulator only

How come I can get license verification on my physical test device, but not on the emulator running on my pc?
When testing from an emulator, no matter what I do, I get NOT_MARKET_MANAGED error. From an actual phone, it passes through with no issues.
Is it because my emulator doesn't have the market app installed and my test device does?
Well, turns out that my emulator did not have a google account setup before trying to run the LVL code. Obviously, if there isn't a google account already setup on the emulator, the LVL has no account to check against for validation.
LVL will still run on an emulator without the Android market installed.
Edit
*Only tested on emulators running Android 2.2*
*LVL will NOT work on emulators running 2.3 or greater, evidently it's a known bug*
Well, you got a real problem: it's a known bug. There's a way out, although. You must separate the MVC code from the license check routines(there's an pretty good example here). Once you have finished to test your code in multiple emulated API versions, you can add the licence check activity to you project and mark it as MAIN and LAUNCHER in the manifest, upload the app to your phone and test the authentication. Follow the instructions in the comments and don't forget to make the necessary adjustments (e.g. i had to change the libraries from com.android to com.google.android in the java file, but keep the com.android.vending.LICENSE_CHECK in the manifest uses-permission tags.)
I know this is an old question, but I just had this problem and thought I would update the answer.
I repeatedly got Error Code 291 (error contacting server) for the license check running an emulator on API 15. According to the "accepted" answer at the time I write this, it says "LVL will not work on emulators over API 8 / 2.2 - it is a known bug".
For API 15 I used the Google API's emulator (to include the LVL libraries) and had to go into the Settings and add a test user account and it worked. I now get the appropriate error responses from the Google Play license server according to my account settings in my Google Play account.
The Google Play / Market app is not required if you do both (use a Google API emulator and set up a test account in the emulator). Here is the reference:
http://developer.android.com/google/play/licensing/setting-up.html#acct-signin
During testing, to ensure that your application can successfully query the licensing server, you must make sure that you sign in to an account on the device or emulator using:
The credentials of a publisher account, or
The credentials of a test account that is registered with a publisher account

Categories

Resources