4

Does anyone have experience problems with the location listener on Huawei phones (eg 8 Honor, Honor 7).

I have a background service that implements location listener but for Huawei phones it stops work after about 5-6 position updates.

I've added my app as a protected app in the phone manager.

I don’t know if these logmessages are helpful to find out what is wrong:

HwLocationPowerTracker - stop namespace.my.app location

HwLauncher - Launcher.MotionManager stopMotionAppsReco service flg 402 is unavailable

HwLauncher - Launcher.MotionManager stopMotionAppsReco service flg 403 is unavailable

HwSystemManager - HsmIntentService:last work complete! lets stop service.

Anders
  • 288
  • 4
  • 10

2 Answers2

1

The solution to the problem has finally been found. In the Manifest file

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="My.App.Package"   
<application
android:process="My.App.Package">
</application>

package and android:process had to be equal (case sensitive).

When requesting the wake lock I also changed "My.App.Tag" to "LocationManagerService".

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);           
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "LocationManagerService");

Other settings that are necessary is to add the app as a protected app and protect it from being caught by battery saving processes. That Can be done in the phones settings.

Anders
  • 288
  • 4
  • 10
  • 1
    Can you confirm if this is still working as of today? I've tried everything and I'm getting desperate – Cilvet Jun 04 '20 at 11:39
0

I did the same thing with Anders, the difference is that I did not add the process to the androidManifest.

If you use FusedLocationProviderClient update location, you must add the google play service to the battery optimization whitelist, and turn off the automatic management (the default is on) .
Enable 1.Auto start 2.Allow background , otherwise you will not be able to get location information from google play service

Such a pathological OEM, Developer's Nightmare - China Mobile

lazy
  • 149
  • 8