Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect Android emulator for Android setup #93

Merged
merged 2 commits into from Feb 28, 2022
Merged

Conversation

joshdholtz
Copy link
Contributor

Motivation

Fixes #89
Some Android emulators were not being detected by the RuntimePlatform.Android check

Description

  • Some emulators (not all) are not detected by Application.platform == RuntimePlatform.Android
  • Adds IsAndroidEmulator() function
    • Attempts to initialize an android.os.Build class to extract the FINGERPRINT
    • If FINGERPRINT is generic then it should be an Android emulator
    • Wrapped in try/catch because creating AndroidJavaClass will fail on iOS

⁉️ Additional thought... We could just get rid of the FINGERPRINT and rely on AndroidJavaClass because we don't care if its an emulator or not. We only care about it its an Android device 🤷‍♂️

@joshdholtz joshdholtz requested a review from a team February 23, 2022 21:51
RevenueCat/Scripts/Purchases.cs Outdated Show resolved Hide resolved
RevenueCat/Scripts/Purchases.cs Outdated Show resolved Hide resolved
@joshdholtz joshdholtz merged commit b7efd17 into main Feb 28, 2022
@joshdholtz joshdholtz deleted the detect-android-emulator branch February 28, 2022 11:30
@aboedo aboedo mentioned this pull request Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when not setting deprecatedLegacyRevenueCatAPIKey on simulator
2 participants