Search code examples
androidappsflyer

Use AppsFlyer link to install apk but can't get number of install


I want to use AppsFlyer to trace that user will use which link to download and install my apk.

My apk will not publish on GooglePlay, it will on the other platform, so I put my apk on google drive temporarily.

I create an OneLink include download url and SHA256 key in AppsFlyer, then I use this OneLink to create an attribute link that user can use the attribute link to the download page.

I can see the number of Clicks from each attribute link, but the number of install is always 0, I really use the attribute link to download the apk to install and then open it.

How can I fix that, thank you!

Here is my AndroidManifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.test.example">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
        android:name="com.test.example.AFApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter  android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https"
                    android:host="lsj.onelink.me"
                    android:pathPrefix="/gIzB" />
            </intent-filter>
        </activity>

    </application>

</manifest>

Here is my AFApplication:

package com.test.example;

import android.app.Application;
import android.util.Log;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerConversionListener;
import java.util.Map;

public class AFApplication extends Application {

    private static final String AF_DEV_KEY = "mykey...";

    @Override
    public void onCreate() {
        super.onCreate();
        AppsFlyerConversionListener conversionListener = new AppsFlyerConversionListener() {

            @Override
            public void onConversionDataSuccess(Map<String, Object> conversionData) {
                for (String attrName : conversionData.keySet()) {
                    Log.d("LOG_TAG", "attribute: " + attrName + " = " + conversionData.get(attrName));
                }
            }

            @Override
            public void onConversionDataFail(String errorMessage) {
                Log.d("LOG_TAG", "error getting conversion data: " + errorMessage);
            }

            @Override
            public void onAppOpenAttribution(Map<String, String> conversionData) {
                for (String attrName : conversionData.keySet()) {
                    Log.d("LOG_TAG", "attribute: " + attrName + " = " + conversionData.get(attrName));
                }

            }

            @Override
            public void onAttributionFailure(String errorMessage) {
                Log.d("LOG_TAG", "error onAttributionFailure : " + errorMessage);
            }
        };
        AppsFlyerLib.getInstance().init(AF_DEV_KEY, conversionListener, getApplicationContext());
        AppsFlyerLib.getInstance().startTracking(this);
    }
}

Solution

  • The declared package name in the AndroidManifest.xml snippet you shared is com.test.example, is this the actual package name?

    The issue might be a mismatch between the package name as defined on AppsFlyer's Dashboard and the actual Android package name (as defined in the AndroidStudio project) - The two should always match.