(OLD) Common Methods

The NeuroID SDKs all share common methods.

Signal Collection

The NeuroID Mobile SDK silently captures user interactions in a manner that does not block the main thread. All user interactions captured omit any text entered by the user. The SDK never collects sensitive user data.

Examples of interactions we capture:

iOS

  • UIViewController life cycle: viewDidLoad, viewWillAppear, viewWillDisappear
  • UITextField, UITextView notifications: textDidBeginEditingNotification, textDidChangeNotification, textDidEndEditingNotification
  • UIControl touch events: touchDown, touchUpInside, touchUpOutside

Android

  • Activities/Fragments life cycle: onStart(), onResume(), onPaused(), onDestroyed, onFragmentAttached(), onFragmentDetached()
  • UI widgets/Containers/Views: EditText, Spinner, Button, CheckBox, RadioButton, RadioGroup, Switch, RecyclerView, WebView
  • Events: TOUCH_MOVE, TOUCH_START, TOUCH_END, FOCUS, WINDOW_BLUR, INPUT

Setting the Screen Name

Every time a new screen is presented to the user, use the setScreenName method to associate all captured data with that screen.

Note: It is important to do this after starting the NeuroID SDK and before each screen renders.

Note: For React-Native this should be done in the Parent View element's onLayout callback prop.

// YourAppNameApp.swift
NeuroID.start()

//UserDetails.swift
var body: some View {
    // Your Code
    // ...
    .onAppear {
        do {
            try NeuroID.setScreenName(screen: "UserDetails");
        } catch {
            print("NeuroID SDK is not started")
            return false
        }
    }
    // ...
}
// AppLaunch.swift
NeuroID.start()

// The user detail view
// UserDetails.swift
func viewWillAppear(false){
    do {
        try NeuroID.setScreenName(screen: "UserDetails");
    } catch {
        print("NeuroID SDK is not started")
        return false
    }
    super()
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)
    binding.apply {
        // Your code
        // ...
        try {
        	  NeuroID.getInstance()?.setScreenName("UserDetails")
        } catch (e: Exception) {
            println("NeuroID SDK is not started ${e.message}")
        }
        // ...
    }
}


function MyForm(): JSX.Element {
  const [name, setName] = useState("");
 
  const setupPage = async () => {
    await NeuroID.setScreenName('my_form_screen_name');
  };

  return (
    <View onLayout={setupPage}>
    	<Text>Name:</Text>
    	<TextInput
        placeholder={"Name"}
        accessibilityLabel={"Name"}
        value={name}
        onChangeText={(v:string)=>setName(v)}
        testID={"Name"}
        id={"Name"}
      />
          
          
      <Button title={"Submit Application"} onPress={()=>NeuroID.stop()} />
    </View>
  );
}

❗️

Important: <3.1.0 -setScreenName MUST be called AFTER calling start.

NeuroID does not start collecting events until AFTER the start method is called. setScreenName is an event that NeuroID requires to be captured for a valid session.

setScreenName will throw an exception when called prior to calling the start method.


Marking Attempted Logins

If NeuroID is configured for a login page then use the attemptedLogin command whenever the login is attempted (through button click or biometric). This should be done regardless of login success. Optionally, you can include the attempted userID. See full API documentation.

NeuroID.attemptedLogin("myLoginID")

// Identifier Not Required
NeuroID.attemptedLogin()
NeuroID.getInstance()?.attemptedLogin("myLoginID")

// Identifier Not Required
NeuroID.getInstance()?.attemptedLogin()
await NeuroID.attemptedLogin("myLoginID")

// Identifier Not Required
await NeuroID.attemptedLogin()

Excluding Views

In circumstances where you want to completely exclude a view and its subviews from any signal/event capturing, pass your views to the excludeView function, as shown below.

Note: This is not available in React Native at this time.

let myView = UIView()

// Any subviews in the view passed in will also not be tracked.
NeuroID.excludeViewByTestID(excludedView: myView.id)
NeuroID.getInstance()?.excludeViewByResourceID("view_id_string")

Optimizing Your Installation with Field Identifiers

While the NeuroID Mobile SDK installation should already be collecting signals, we recommend one additional step to ensure the best experience when viewing and understanding the data, particularly in the customer portal.

For each input field in your application, we recommend setting a field identifier ( contentDescription attribute (or id field in XML) for Android, accessibilityIdentifier for iOS, or testID/accessibilityLabel attribute for React Native).

The field identifier is used by the SDK in order to name and group interactions.

If you do not set a field identifier the SDK will attempt to do it using fallback placeholders. If no fallback can be found a auto-generated identifier will be assigned.

  • For React Native, if the element is not a native UI element in iOS or Android the element will be ignored. (I.e. a custom Pressable without a testID will not be captured)

Examples for each platform can be found below.

// progamatically in Kotlin (Android)
textView.contentDescription = "email field"
// in XML layout (Android)
<TextView
        android:id="@+id/textView_description"
        .
        .
        android:contentDescription="email_field"
        .
        .
        app:layout_constraintEnd_toEndOf="parent"/>
TextField("Email", text: $input)
    .accessibilityIdentifier("emailField")
    .accessibilityLabel("emailField")
let emailTextField = UITextView()
emailTextField.id = "emailField"
  <TextInput
    	testID="name"
			accessibilityLabel="name"
    	onChangeText={t => setText(t)}
    	defaultValue={text}
   />