-
Notifications
You must be signed in to change notification settings - Fork 0
Android SDK Setup
We are working on setting up our Nexus Repositories. Please download our AAR bundles to integrate our Android SDK.
Add the following to the root gradle file.
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
compile 'com.github.appsflyio.appsfly-runtime-android:core:0.0.14'
Core library has all the libraries to run Appsfly Plugins.
compile 'com.github.appsflyio.appsfly-runtime-android:micro-app:0.0.14'
This library has the dependency on Core Library. This will enable MicroApps to fly into the user's context in the publisher application.
Note: If MicroApps are not used in the publisher application, skip Step 2.
Override your Application/Activity3 Instance onCreate() method
@Override
public void onCreate() {
super.onCreate();
String repoUrl = "REPO_URL"; // Current repo url is 'https://microapps.appsfly.io/executor/fetch-build'
String microModuleId = "MICRO_MODULE_ID"; // MicroApp Id
String associationKey = "YOUR_ASSOCIATION_KEY"; // Association key created on the dashboard
ArrayList<AppsFlyClientConfig> appsFlyClientConfigs = new ArrayList<AppsFlyClientConfig>();
AppsFlyClientConfig appsflyConfig = new AppsFlyClientConfig(microModuleId, associationKey, repoUrl);
appsFlyClientConfigs.add(appsflyConfig);
AppsFlyProvider.getInstance().initialize(appsFlyClientConfigs, this);
}
This will start the process of syncing Metadata required to run MicroApp in your application.
Note: If you are using application class, do not forget to reference the class name in your manifest file. Note: PROJECT_ID, MICROAPP_ID & ASSOCIATION_KEY can be obtained from MicroApp Service Provider.
To launch the MicroApp, run the following snippet where there is a call to action.
AppsFlyProvider.getInstance().pushApp("MICRO_MODULE_ID", "ASSOCIATION_ID", "INTENT", new JSONObject()*{}*, context);
Note: This will create an overlay activity showing the MicroApp.
//Put user context data inside a JSONobject and pass it as intent data.
JSONObject userContextData = new JSONObject();
data.put(*key* , *value*);
String intentString = "INTENT";
AppsFlyProvider.getInstance().pushApp("MICRO_MODULE_ID", "ASSOCIATION_ID", intentString", userContextData, context);
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK && requestCode == AppsFlyProvider.REQUEST_CODE) {
String dataStr = data.getStringExtra("result");
JSONObject resultData;
try {
resultData = new JSONObject(dataStr);
} catch (JSONException e) {
e.printStackTrace();
}
//Get values from resultData with keys specified by the MicroApp Service Provider .
Object value1 = result.get(*key1*);
String value2 = result.getString(*key2*);
}
}
The SDK available for download in this integration documentation is in a sandbox environment. Contact the [email protected] to get a production build.
Copyright Dhurya Technologies Pvt. Ltd. ® 2016
Note:
Currently, this documentation is in beta phase and is being updated regularly. It aims to ensure a smooth integration of AppsFly SDK into your projects. For any suggestions or to report any issues with the information mentioned here, please contact [email protected]
-Team AppsFly.io