mirror of https://github.com/M66B/NetGuard.git
Check if Play services available
This commit is contained in:
parent
e60a24b22a
commit
d89c6c2ed4
|
@ -419,7 +419,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
}
|
||||
|
||||
// Ads
|
||||
if (!IAB.isPurchasedAny(this))
|
||||
if (!IAB.isPurchasedAny(this) && Util.hasPlayServices(this))
|
||||
loadAds();
|
||||
|
||||
// Handle intent
|
||||
|
@ -446,7 +446,7 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
|
|||
Log.i(TAG, "Config changed");
|
||||
super.onConfigurationChanged(newConfig);
|
||||
|
||||
if (!IAB.isPurchasedAny(this))
|
||||
if (!IAB.isPurchasedAny(this) && Util.hasPlayServices(this))
|
||||
reloadAds();
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,9 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.GoogleApiAvailability;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -375,6 +378,11 @@ public class Util {
|
|||
return "com.android.vending".equals(context.getPackageManager().getInstallerPackageName(context.getPackageName()));
|
||||
}
|
||||
|
||||
public static boolean hasPlayServices(Context context) {
|
||||
GoogleApiAvailability api = GoogleApiAvailability.getInstance();
|
||||
return (api.isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS);
|
||||
}
|
||||
|
||||
public static String getFingerprint(Context context) {
|
||||
try {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
|
|
Loading…
Reference in New Issue