UnifiedNlp icon indicating copy to clipboard operation
UnifiedNlp copied to clipboard

UnifiedNlp finally works on AOSP 9.0

Open perdubug opened this issue 5 years ago • 1 comments

I build an Android P ROM that's based on AOSP(android-9.0.0_r18) for my Pixel device. But UnifiedNlp of MicroG didn't work on my device. The getLastKnownLocation API of Android SDK got null. Also, 'Network-based location enabled' is unchecked in Self-Check.

The following is what I did:

  • Add microG patch in framework/base/services/core/java/com/android/server/ServiceWatcher.java by refer to https://github.com/microg/android_packages_apps_GmsCore/tree/master/patches
  • Install MicroG as /system/priv-app by putting it in AOSP build tree with below lines in its Android.mk ... LOCAL_CERTIFICATE := platform LOCAL_PRIVILEGED_MODULE := true
  • After reboot device, install Backends from F-Droid, like AppleWifi, Mozilla Location Service, etc.
  • Enable backends in microG Settings->UnifiedNlp Settings->Configure location backends;
  • Reboot device
  • Self-Check in microG Settings. The 'Network-based location enabled' option is unchecked.

Finally, I made UnifiedNlp works. Here's what I changed: Allowing 'network' as Location Provider in framework/base/packages/SettingsProvider/res/values/defaults.xml. Change "def_location_providers_allowed" value from 'gps' to 'gps,network'

perdubug avatar Feb 25 '19 09:02 perdubug

Nice catch, thanks! Finally I can use it. You can also enable this at runtime in a shell with: settings put secure location_providers_allowed +network. So is this an Android-problem/bug or one of microg? Should microg (unifiednlp) set this setting or should it be configurable in some android-gui?

stapel avatar Apr 19 '19 16:04 stapel