Android SDK Quick Start Start by Using Hyphen Android SDK
Create an App in the Dashboard
You need to create an app in the Hyphen Dashboard before using Hyphen SDK. After creating an app, an app secret will be issued. The app secret is required to initialize the SDK.
Install the SDK using Gradle
We recommend Gradle to install our SDK.
build.gradle build.gradle.kts
Edit build.gradle
of your app level module to add Hyphen SDK.
Copy implementation "at.hyphen:android-sdk-core:1.0.0-alpha06"
implementation "at.hyphen:android-sdk-authenticate:1.0.0-alpha06"
implementation "at.hyphen:android-sdk-networking:1.0.0-alpha06"
implementation "at.hyphen:android-sdk-ui:1.0.0-alpha06"
implementation "at.hyphen:android-sdk-flow:1.0.0-alpha06"
Edit build.gradle.kts
of your app level module to add Hyphen SDK.
Copy implementation("at.hyphen:android-sdk-core:1.0.0-alpha06")
implementation("at.hyphen:android-sdk-authenticate:1.0.0-alpha06")
implementation("at.hyphen:android-sdk-networking:1.0.0-alpha06")
implementation("at.hyphen:android-sdk-ui:1.0.0-alpha06")
implementation("at.hyphen:android-sdk-flow:1.0.0-alpha06")
Firebase Configuration
Need your Firebase project to use Hyphen SDK. After enabling Google Authenticate and Push Messaging in your Firebase project, complete the Firebase setup through the google-services.json
file.
Please read the link below to set up Firebase.
https://firebase.google.com/docs/android/setup
Configuring the SDK
Declaring Permission
The following permissions are required to use the Hyphen SDK. Insert the code snippet below your AndroidManifest.xml
.
Copy <!-- Required for hyphen networking (communicate with hyphen api server / flow network) -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required for signing with device key -->
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<!-- Required for 2fa / transaction request notifications -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
Register Hyphen Activity
SDK has its own activity to handle 2FA authenticate, transaction requests. Register the activity in your AndroidManifest.xml
.
Copy <activity
android:name="at.hyphen.android.sdk.ui.twofactor.Hyphen2FAActivity"
android:exported="true" />
Initialize SDK
Insert the code below into the onCreate
area of the class that inherited the Application
used within the app.
[YourActivityName]Activity.kt
Copy import at.hyphen.android.sdk.core.Hyphen
class MainActivity : Application() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// ...
Hyphen.initialize(context = this)
Hyphen.appSecret = "<YOUR-APP-SECRET>"
Hyphen.network = Hyphen.NetworkType.TESTNET // or MAINNET
}
}