androidlocationandroid-4.4-kitkat

Why NETWORK_PROVIDER is not available?


I am working on a GPS device (not a phone, no screen ...) with a custom rom. My app is a system app.

NETWORK_PROVIDER is not available, only FUSED_PROVIDER and GPS_PROVIDER are enable. I check with this code :

locationManager.getProvider(LocationManager.FUSED_PROVIDER) != null,
locationManager.getProvider(LocationManager.NETWORK_PROVIDER) != null
locationManager.getProvider(LocationManager.GPS_PROVIDER) != null

getAllProviders() return [passive, gps]

I have tried with Wifi enable and disable, same result.

I am listening the location like this :

Settings.Secure.putInt(caniGPSApplication.getApplicationContext().getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
locationManager.requestLocationUpdates(LocationManager.FUSED_PROVIDER, GPSTimerMS, 0, this);

I think FUSED_PROVIDER is not working because NETWORK_PROVIDER is not available but I do not really know.

I wish to have NETWORK_PROVIDER because it will help to have a location when GPS is not available. Do you know why NETWORK_PROVIDER is not available ? What should I do to enable it ?

Thank you :)


Solution

  • I have solved the problem.

    I have added 3 packages in priv-app :

    NetworkLocation.apk is a apps which replace the Google Network provider, this one is only a middleware and need providers to get data (cells database ...).

    Off course i am working on a custom rom, I can install apk in priv-app, consequently I have all specifics right necessary to do it.