Skip to content

Commit

Permalink
[TIMOB-20522] Improve validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Mathews committed Feb 21, 2018
1 parent 2923853 commit 9cfe99c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,12 @@ public static boolean validVersion()

public static boolean available(Context context)
{
googleApiCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
if (googleApiCode == ConnectionResult.SUCCESS) {
return true;
GoogleApiAvailability availability = GoogleApiAvailability.getInstance();
if (availability != null) {
googleApiCode = availability.isGooglePlayServicesAvailable(context);
if (googleApiCode == ConnectionResult.SUCCESS) {
return true;
}
}

Log.w(TAG, "Google Play Services is not available");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.appcelerator.kroll.KrollProxy;
import org.appcelerator.kroll.annotations.Kroll;
import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.util.TiConvert;

Expand Down Expand Up @@ -105,7 +106,8 @@ public LocationProviderProxy(String name, double minUpdateDistance, double minUp
*/
public Object getLocationCallback()
{
if (locationCallback == null && FusedLocationProvider.hasPlayServices(getActivity())) {
if (locationCallback == null
&& FusedLocationProvider.hasPlayServices(TiApplication.getAppRootOrCurrentActivity())) {
locationCallback = FusedLocationProvider.createLocationCallback(providerListener, getName());
}
return locationCallback;
Expand Down

0 comments on commit 9cfe99c

Please sign in to comment.