Android integration openinstall

The role of openinstall:

Step 1: Log in to the openinstall official website and register if you don’t have an account

Step 2: Add an app if you don’t have one (select the premium version)

Step 3: Download and import the sdk (actually just a jar)

Put the downloaded OpenInstall_v2.3.0.jar into the libs folder, and then add it under [build.gradle]

dependencies {
     implementation  files('libs/OpenInstall_v2.3.0.jar')

Step 4: Add permission declaration in AndroidManifest.xml

<uses-permission android: />
<uses-permission android: />

Step 5: Set AppKey in the application tag of AndroidManifest.xml


Step 6: Add initialization code to the application

public void onCreate() {
    if (isMainProcess()) {

//Determine whether it is the main process 
public boolean isMainProcess () {
    int pid = android.os.Process.myPid();
    ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    for (ActivityManager.RunningAppProcessInfo appProcess : activityManager.getRunningAppProcesses()) {
        if ( == pid) {
            return getApplicationInfo().packageName.equals(appProcess.processName);
    return  false ;

Step 7: Specify your application in AndroidManifest.xml


Step 8: Implement fast download

If you only need the fast download function, no other functions (installation with parameters, channel statistics, one-click pull-up) are required, and the initialization can be completed.

Step 9: Install with parameters, add the following code in the application

private  void  openInstall ()  {
    OpenInstall.init( this ); 
     //Install with parameters 
    OpenInstall.getInstall( new AppInstallAdapter() {
        public  void  onInstall (AppData appData)  {
            Log.d(TAG, "appData=" + appData);
             //Get channel data
            channelCode = appData.getChannel();
            //Get custom data 
            try {
                duanzishou = new JSONObject(appData.getData()).optString("duanzishou");
            } catch (JSONException e) {

Step 10: Test the installation with parameters (the application scenario is to invite others to download and install without filling in the invitation code, etc. The information of the invitation code is in the custom parameters of the link, such as the download link https://app-* *** 3*****, after the invited user installs, openinstall obtains custom parameters, and then can register through the interface Upload this parameter value to the background server)

  1. On the openinstall official website, click Android Integration, click APK Package, and click Upload APK File

  2. In the list below this interface, click Test

  3. In the key in the pop-up box, write the custom parameter name to be obtained written in the application, and click Generate Test Connection

  4. Click the link to jump to the download apk interface, click Use Now, download the apk, and install it on the phone

5. Delete the previous package, install the downloaded package on the phone, open it, and see the result (channel is not set, the custom parameters are obtained)

Step 11: Add code to the activity that needs to be pulled up with one click

protected void onCreate(Bundle savedInstanceState) {

    OpenInstall.getWakeUp(getIntent(), wakeUpAdapter);
protected  void  onNewIntent (Intent intent)  {
     super .onNewIntent(intent);
     // To be called here, otherwise the App will not be able to intercept when it is running in the background
    OpenInstall.getWakeUp(intent, wakeUpAdapter);
AppWakeUpAdapter wakeUpAdapter = new AppWakeUpAdapter() {
    public  void  onWakeUp (AppData appData)  {
         //Get channel data
        String channelCode = appData.getChannel();
        //get binding data
        String bindData = appData.getData();
        Log.d("appData", "getWakeUp : wakeupData = " + appData.toString());
protected void onDestroy() {
    wakeUpAdapter = null;

Step 12: Add an intent-filter (usually MainActivity) to the activity tag of the wake-up page in AndroidManifest.xml, and configure the scheme for pulling up in the browser

    <action android:/>
    <category android:/>
    <category android:/>
    <data android:scheme="******"/>

Step 13: Upload apk, set custom parameters and values, generate link and QR code, scan the QR code, and the mobile phone will jump to the link interface, click to use it immediately, and it will automatically jump to the program

Step 14: View the value of the acquired parameter pulled up with one key

Step 15: Configure channel parameters, click Channel Management, add a channel, and then click the channel link to display https://app-* (there is channel information channelCode here , but this link has no custom parameters, there is a custom link with parameters but no channel information, if I want both, (this connection is generated in the background, given in the background, I will splicing it here) https: //app-*** )

Step 16: Generate a QR code from the spliced ​​link on the forage QR code website (

Step 17: Scan the QR code, download the apk, install, open, and test whether the parameters are obtained

Step 18: Statistics of registrations (see business needs)

//Call OpenInstall.reportRegister() after user registration is successful;

Step 19: View application statistics and channel reports

Leave a Comment

Your email address will not be published. Required fields are marked *