Hyphen
  • Hyphen
  • Concepts
    • Auth Methods
    • Hyphen Multi-Sig Account
      • Device Key
      • Recovery Key
      • Server Key
    • Paymaster
    • Hybrid Custody
  • Mechanism Paper
  • iOS SDK
    • Quick Start
    • Authenticating Users
    • Using Hyphen UI Kit
      • Account Management Screen
    • Sample Project
  • Android SDK
    • Quick Start
    • Authenticating Users
    • Handling 2FA / Transaction Request
    • Using Hyphen UI Kit
    • Sending Transactions
  • Flutter SDK
    • Quick Start
    • Authenticating Users
    • Using Hyphen UI Kit
    • Sending Transactions
    • Example App
  • Hybrid Custody
    • Into the Hybrid Custody
  • Without Using SDK
    • Authenticating Users
    • Handling 2FA Push
  • REST API
    • API Reference
      • Account
      • Auth
      • Device
      • Key
      • Sign
    • Swagger
Powered by GitBook
On this page
  • Request Notification Permission
  • Add Firebase Messaging Service
  • Handling Hyphen Notification Click

Was this helpful?

  1. Android SDK

Handling 2FA / Transaction Request

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

PreviousAuthenticating UsersNextUsing Hyphen UI Kit

Last updated 1 year ago

Was this helpful?

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)
    }
}
<service
    android:name=".SampleMessagingService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

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)
        }
    }
}
Notification runtime permission  |  Android DevelopersAndroid Developers
Logo