FAQ

What is the minimum supported platform version for MetaKeep Mobile SDK?

Please find the mobile SDK requirements for Android here and iOS here.

Is mobile SDK compatible with React Native or Flutter?

Yes, MetaKeep mobile SDK is compatible with React Native and Flutter.

When do we have to initialize the SDK?

On Android, the SDK can only be initialized inside an Activity or Fragment (or with access to a valid Context).

On iOS, the SDK can be initialized anywhere in the app.

On React Native/Flutter, the SDK can be initialized anywhere in the app.

Getting unsupported browser error?

We intentionally block unsupported and outdated browsers to ensure the security of our users.

Do I need to make SDK calls from the main/UI thread?

SDK calls can be made from any thread. SDK internally performs UI operations on the main/UI thread.

On which thread is the callback or the Promise object executed?

On both Android and iOS, the callback is executed on the main/UI thread. However, this behavior is platform-dependent and may change in the future. If you make UI changes in the callback, we recommend you run the code on the main/UI thread.

On React Native, the Promise object is executed on the main/UI thread.

Here's how to run a function on the main/UI thread:

sdk.signMessage(
    // message
    "Hello World",
    // signing reason
    "reason",
    // Callback
    Callback(
        onSuccess = { response: JsonResponse ->
            Log.d("onSuccess", response.toString())

            // Run on the main thread.
            runOnUiThread {
                // UI changes here
            }
        },
        onFailure = { error: JsonResponse ->
            Log.d("onFailure", error.toString())
        },
    ),
)
sdk.signMessage(
  // message
  message: "Hello World",
  // signing reason
  reason: "reason",
  // Callback
  callback: Callback(
    onSuccess: { (result: JsonResponse) in
      print("onSuccess")
      print(result.description)
                
      // Run on the main thread.
      DispatchQueue.main.async {
        // UI changes here
      }
    },
    onFailure: { (error: JsonResponse) in
      print("onFailure")
      print(error.description)
    }
  )
)

SDK doesn't work in release mode on Android

The app might not work in the release mode due to code minification on Android. To fix this, you can disable code minification by adding the following line to your android/app/build.gradle file:

buildTypes {
    release {
        shrinkResources false
        minifyEnabled false
    }
}

If you don't want to disable code minification for the entire app, you can disable it for MetaKeep SDK by adding the following line to your android/app/build.gradle file:

buildTypes {
    release {
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

Then, create a proguard-rules.pro file in the android/app folder and add the following line to it:

-keep class xyz.metakeep.** { *; }

The app gets stuck in the browser and doesn't return after the operation

  1. Make sure that you have followed the SDK setup instructions for your platform correctly to configure the callback.
  2. Make sure that the app package name contains valid characters. Only a-z, 0-9, +, -, and . should be used in the package name.

© Copyright 2024, Passbird Research Inc.