Don't use GMS to detect if GMS is available (#3525)
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
package mihon.telemetry
|
||||
|
||||
import android.content.Context
|
||||
import com.google.android.gms.common.ConnectionResult
|
||||
import com.google.android.gms.common.GoogleApiAvailability
|
||||
import android.content.pm.PackageManager
|
||||
import com.google.firebase.FirebaseApp
|
||||
import com.google.firebase.analytics.FirebaseAnalytics
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
@@ -34,11 +33,11 @@ object TelemetryConfig {
|
||||
|
||||
private fun isGooglePlayServicesAvailable(context: Context): Boolean {
|
||||
return try {
|
||||
val availability = GoogleApiAvailability.getInstance()
|
||||
val resultCode = availability.isGooglePlayServicesAvailable(context)
|
||||
resultCode == ConnectionResult.SUCCESS
|
||||
} catch (e: Exception) {
|
||||
logcat(LogPriority.WARN, e) { "Unable to check Google Play Services availability" }
|
||||
context.packageManager
|
||||
.getPackageInfo("com.google.android.gms", PackageManager.GET_META_DATA)
|
||||
.applicationInfo
|
||||
?.enabled == true
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user