Getting Started with Android SDK
Important:
Android Simulator can not be used for audio in real time. You must connect an Android phone for testing. The x86, x64 and arm64 architectures are not supported yet.
Minimum Technical Requirements
The Voicemod Android SDK is supported on armeabi-v7a or higher.
The Voicemod Android SDK works with any Android 5 device (Lollipop, API Level 21).
Set minSdkVersion
In the build.gradle file from the module that use VoicemodSDK library, set your minSdkVersion to 19.
1 2 3 4 5 6 7 8 9 |
android { ... defaultConfig { ... minSdkVersion 19 ... } ... } |
Add the precompiled VoicemodSDK-$VERSION.aar to your app proyect.
The first step you have to do to add Voicemod SDK in your application is add the precompiled library in your project structure.
Gradle will find the precompiled library if you add the path where it is located to flatdirs.
In the example application, for easy access to the .aar file, we have located it inside the root of the zip file, modifiying the project build.gradle.
1 2 3 4 5 6 7 8 |
Allprojects { repositories { jcenter() flatDir{ dirs '..' } } } |
Dependencies
There are two dependencies that must be added: The version of play-services-lib that best suits your project and the VoicemodSDK precompiled library.
1 2 3 4 5 |
// Dependency to Iid from Google Play Services compile 'com.google.android.gms:play-services-iid:11.0.4' // Dependency to Voicemod SDK compile (name: 'VoicemodSDK-$VERSION', ext: 'aar')} |
Modifying $VERSION with the suffix of the aar file version.
Now you can sync your project for the next step.
Proguard
If you are using proguard add this line to proguard-rules.pro file.
1 |
-keep class com.google.android.gms.iid.InstanceID { *; } |
Initialize the SDK
Override your Application OnCreate method
To initialize Voicemod SDK make a call to the start method.
1 |
VoicemodSDK.start(Application application) |
This call must be made in the OnCreate method of the class that overrides the Application class, using this as the parameter value. In the sample application this task is performed by the AppOverrideExample class.
1 2 3 4 5 |
public void onCreate() { super.onCreate(); VoicemodSDK.enableDebugMode(); VoicemodSDK.start(this); } |
Remember to modify AndroidManifest.xml indicating in the application label the parameter name.
1 2 3 4 |
<application android:name=".AppOverrideExample" ... > |
Add “voicemod.clientKey” meta-data tag.
Then, in the file AndroidManifest.xml, inside Application tag, you will have to add the client key, that you obtained in the dashboard, on an meta-data tag named “voicemod.clientKey” as follows:
1 2 3 |
<meta-data android:name="voicemod.clientKey" android:value="YOUR_CLIENT_KEY_HERE" /> |