google-location-services

Geofence transition PendingIntent blocked by the OS on Android Oreo

久未见 提交于 2019-12-02 21:30:30
This only happens on Android Oreo. I'm using Play Services 11.4.2. I'm registering geofences using the GeofencingClient and the addGeofences method with a pendingIntent to an IntentService that is handling geofence transitions. It looks like the intent sent by the play services is blocked by the OS in certain conditions. The system logs the following: Background start not allowed: service Intent { cmp=my.app.id/my.package.struct.GeofenceTransIntentService (has extras) } to my.app.id/my.package.struct.GeofenceTransIntentService from pid=-1 uid=10154 pkg=my.app.id as soon as I add a geofence in

Found an error that GoogleApiClient is not connected yet

我与影子孤独终老i 提交于 2019-12-02 14:36:16
问题 private final static int CONNECTION_FAILURE_RESOLUTION_REQUEST = 9000; private double currentLatitude; private double currentLongitude; private GoogleApiClient mGoogleApiClient; private LocationRequest mLocationRequest; Button btn_start; TextView txt_refersh; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_demo); btn_start = (Button) findViewById(R.id.btn_start); txt_refersh = (TextView) findViewById(R.id.txt

Unable to retrieve location using 'LocationManager.NETWORK_PROVIDER' even when WiFi is enabled in device running android M

此生再无相见时 提交于 2019-11-29 17:26:21
I'm trying to retrieve location using LocationManager following this tutorial. I'm running the code on an android device running Marshmallow and I have checked the permission and running below code once the permission is granted. Here's my code: public Location getLocation() { try { locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); // getting GPS status isGPSEnabled = locationManager .isProviderEnabled(LocationManager.GPS_PROVIDER); // getting network status isNetworkEnabled = locationManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled &&

How can location updates from FusedLocationProviderClient be processed with Work Manager?

这一生的挚爱 提交于 2019-11-28 12:36:49
First of all, I'm a total Android noob. Have looked for solutions for some time now, but can't find any helpful hints in the right direction so far. This might be generally caused by the nature of the issue itself, being quite niche. The working code below is based on a code lab at https://codelabs.developers.google.com/codelabs/realtime-asset-tracking . I was wondering though, since it was mentioned within several resources as the preferred way now, how you'd do something like that based on Android's Work Manager instead of a Service with an ongoing notification? public class TrackerService

How can location updates from FusedLocationProviderClient be processed with Work Manager?

我怕爱的太早我们不能终老 提交于 2019-11-27 06:13:05
问题 First of all, I'm a total Android noob. Have looked for solutions for some time now, but can't find any helpful hints in the right direction so far. This might be generally caused by the nature of the issue itself, being quite niche. The working code below is based on a code lab at https://codelabs.developers.google.com/codelabs/realtime-asset-tracking. I was wondering though, since it was mentioned within several resources as the preferred way now, how you'd do something like that based on