Handling 2FA / Transaction Request

How to handle an attempt to 2fa authenticate or when a request for signing transaction.

Request Notification Permission

You must request Notification Permission to receive notifications from Android 13+.

Add Firebase Messaging Service

FirebaseMessagingService must be implemented to receive push notifications. If the service is already exist, you only need to add code related to Hyphen.

import at.hyphen.android.sdk.ui.HyphenUI
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage

class SampleMessagingService : FirebaseMessagingService() {

    override fun onMessageReceived(message: RemoteMessage) {
        HyphenUI.onFirebaseMessageReceived(applicationContext, message)
    }
}

Handling Hyphen Notification Click

Add the code below to the root activity to ensure proper handling when click Hyphen push notification.

class MainActivity : AppCompatActivity(), HyphenAuthenticateDelegate {
    
    // ...
    
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        
        intent?.let {
            HyphenUI.handleHyphenIntent(this, it)
        }
    }
    
    // ...
    
    override fun onNewIntent(intent: Intent?) {
        super.onNewIntent(intent)

        intent?.let {
            HyphenUI.handleHyphenIntent(this, it)
        }
    }
}

Last updated

Was this helpful?