Consent for SIM Binding


✨ Event Routine: onGetUserConsentForSimBinding

🎯 What This Event Does

The SDK fires this event to tell your app: “Show a consent screen to the user and get permission before SIM Binding begins.”


📡 When This Event Is Triggered

You receive this event at the start of SIM Binding when the SDK requires explicit user consent for:

  • 📡 Phone state access
  • ✉️ SMS read/send
  • 🔐 OTP auto-read
  • 📲 SIM verification actions

📦 Event Payload Structure

{
  "challengeOpMode": <int>,
  "response": { ... },
  "error": {
      "longErrorCode": 0,
      "shortErrorCode": 0,
      "errorString": "Success"
  }
}

🧭 Important challengeOpMode Values

ModeMeaning
17Consent + SIM info + mobile number + SMS OTP validation
18Basic SIM binding consent

🧩 What Your App Must Do

  1. 🖼️ Display consent UI
  2. 👤 Ask user to Allow or Deny
  3. 📤 Call setUserConsentForSIMBinding(userConsent, challengeOpMode)

📟 Code Snippets (Collapsible)

Below are platform-specific examples in collapsible sections.


React Native
// Subscribe to the event
import { NativeModules, NativeEventEmitter } from 'react-native';
const rdnaEvents = new NativeEventEmitter(NativeModules.RdnaClient);

const unsub = rdnaEvents.addListener(
  'onGetUserConsentForSimBinding',
  (payload) => {
    showConsentUI(payload.challengeOpMode, (userAccepted) => {
      RdnaClient.setUserConsentForSIMBinding(
        userAccepted,
        payload.challengeOpMode,
        (syncResponse) => {
          console.log('setUserConsentForSIMBinding response', syncResponse);
        }
      );
    });
  }
);

// Remove listener if needed:
// unsub.remove();

Flutter
void initState() {
  super.initState();
  rdnaClient.on(RdnaClient.onGetUserConsentForSimBinding, _onConsentEvent);
}

void _onConsentEvent(dynamic response) {
  final int challengeOpMode = response['challengeOpMode'];

  bool userAccepted = true;

  rdnaClient
      .setUserConsentForSIMBinding(userAccepted, challengeOpMode)
      .then((syncResponse) {
    print('setUserConsentForSIMBinding: $syncResponse');
  }).catchError((err) {
    print('Error: $err');
  });
}

@override
void dispose() {
  rdnaClient.off(RdnaClient.onGetUserConsentForSimBinding, _onConsentEvent);
  super.dispose();
}

Cordova
document.addEventListener(
  'onGetUserConsentForSimBinding',
  function (payload) {
    showConsentUI(payload.challengeOpMode, function (userAccepted) {
      com.uniken.rdnaplugin.RdnaClient.setUserConsentForSIMBinding(
        function (syncResponse) {
          console.log('success', syncResponse);
        },
        function (err) {
          console.error('error', err);
        },
        [userAccepted, payload.challengeOpMode]
      );
    });
  },
  false
);

Native Android (Java)
@Override
public void onGetUserConsentForSimBinding(RDNAChallengeResponse response) {
    int challengeOpMode = response.getChallengeOpMode();

    boolean userAccepted = true;

    RDNA.RDNAError err = RdnaClient.getInstance()
        .setUserConsentForSIMBinding(userAccepted, challengeOpMode);

    if (err != null && err.getShortErrorCode() != RDNAErrorID.RDNA_ERR_NONE.intValue()) {
        Log.e(TAG, "Error: " + err.getErrorString());
    } else {
        Log.d(TAG, "setUserConsentForSIMBinding invoked");
    }
}

Native iOS (Swift)
func onGetUserConsentForSimBinding(_ response: [String: Any]) {
    guard let challengeOpMode = response["challengeOpMode"] as? Int else { return }

    let userAccepted = true

    let result = RDNA.shared().setUserConsentForSIMBinding(
        userAccepted,
        challengeOpMode: UInt(challengeOpMode)
    )

    if let err = result, err.shortErrorCode != RDNAErrorID.RDNA_ERR_NONE.intValue() {
        print("Error: \(err.errorString ?? "Unknown error")")
    } else {
        print("setUserConsentForSIMBinding invoked")
    }
}

✅ Summary

This file contains:

  • Full event description
  • Icons for readability
  • Platform-specific collapsible code blocks