huawei-mobile-services
How to open the Huawei AppGallery directly?
Opening your app in the Huawei App Gallery is similar to opening Google Play Store: Huawei App Gallery: Scheme: market:// or appmarket:// Package: com.huawei.appmarket vs. Google Play Store: Scheme: market:// Package: com.android.vending Here is a snippet for the Huawei App Gallery: private void startHuaweiAppGallery() { Uri detailsUri = Uri.parse(“market://details?id=” + getPackageName()); Intent intent = new … Read more
Huawei Mobile Services SDK violation Device and Network Abuse policy
Update: Note: If you have confirmed that the latest SDK version is used, before submitting a release to Google, please check the apks in all Testing track on Google Play Console(including Open testing, Closed testing, Internal testing). Ensure that the APKs on all tracks(including paused track) have updated to the latest HMS Core SDK. HMS … Read more
onTaskRemoved() not getting called in HUAWEI and XIAOMI devices
On some devices (some LG, Huawei, Xiaomi, and others) your app needs to be manually added to a list of “protected apps” or “apps that are allowed to run in the background” in order for Android to restart STICKY services. If your app has not been manually added to this list, Android just kills your … Read more
FileProvider getUriForFile() error on Huawei devices
Update for Android N (leaving the original answer below and have confirmed this new approach works in production): As you noted in your update, many Huawei device models (e.g. KIW-L24, ALE-L21, ALE-L02, PLK-L01, and a variety of others) break the Android contract for calls to ContextCompat#getExternalFilesDirs(String). Rather than returning Context#getExternalFilesDir(String) (ie the default entry) as … Read more
How to create Huawei Android Emulator
Huawei provides cloud debugging functionality for Huawei developers as a free service. If you use Huawei SDKs, you should have Huawei Developer Account. Just need to login Huawei developer console and follow below instruction; Enables real-time debugging of apps on remote Android devices. Service Introduction For details about how to use Cloud Debugging in your … Read more
Have both GMS and HMS in the project
So, I managed to do it like this: Defined two flavours gms { dimension “services” buildConfigField “String”, “SERVICE_USED”, ‘”g”‘ } hms { dimension “services” buildConfigField “String”, “SERVICE_USED”, ‘”h”‘ } I use the “g” and “h” in the code whenever I need to decide on doing things like: the API requires a deviceType of “android” or … Read more
“Protected Apps” setting on Huawei phones, and how to handle it
There isn’t a setting in the manifest, and Huawei has enabled Tinder because it’s a popular app. There isn’t a way to know if apps are protected. Anyway I used ifHuaweiAlert() in onCreate() to show an AlertDialog: private void ifHuaweiAlert() { final SharedPreferences settings = getSharedPreferences(“ProtectedApps”, MODE_PRIVATE); final String saveIfSkip = “skipProtectedAppsMessage”; boolean skipMessage = … Read more