Skip to content

Commit

Permalink
Merge pull request #65 from tkuenzle/bugfix/issue-56
Browse files Browse the repository at this point in the history
Use context for location provider if activity is not available
  • Loading branch information
matt-oakes committed Jun 2, 2019
2 parents 163ea51 + b895c4d commit 2b9913f
Showing 1 changed file with 7 additions and 2 deletions.
Expand Up @@ -46,8 +46,13 @@ public class RNPlayServicesLocationProvider implements RNLocationProvider {

public RNPlayServicesLocationProvider(Activity activity, ReactApplicationContext context) {
this.context = context;
locationProvider = LocationServices.getFusedLocationProviderClient(activity);
locationSettingsClient = LocationServices.getSettingsClient(activity);
if (activity != null) {
locationProvider = LocationServices.getFusedLocationProviderClient(activity);
locationSettingsClient = LocationServices.getSettingsClient(activity);
} else {
locationProvider = LocationServices.getFusedLocationProviderClient(context);
locationSettingsClient = LocationServices.getSettingsClient(context);
}
}

// Public interface
Expand Down

0 comments on commit 2b9913f

Please sign in to comment.