You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Oreo系统中INSTALL_REFERRER接收器是否仍可正常工作?

关于Android Oreo 8.0上AppsFlyer INSTALL_REFERRER接收异常的解决方案

首先,先确认你当前注册的广播接收器代码:

<receiver android:name="com.appsflyer.SingleInstallBroadcastReceiver" android:exported="true"> 
  <intent-filter> 
    <action android:name="com.android.vending.INSTALL_REFERRER" /> 
  </intent-filter> 
</receiver>

你遇到的问题很典型——Android 8.0(API 26)开始对静态注册的隐式广播做了严格限制,而com.android.vending.INSTALL_REFERRER正好属于被限制的范畴,这就是为什么你的应用在Android 5.1.1上能正常工作,但在Galaxy S8+(8.0)上出现异常的核心原因。

具体修复步骤:

  1. 更新广播接收器类
    把原来的SingleInstallBroadcastReceiver替换为AppsFlyer提供的适配Oreo及以上系统的AppsFlyerInstallReceiver,更新后的注册代码如下:

    <receiver
        android:name="com.appsflyer.AppsFlyerInstallReceiver"
        android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>
    
  2. 升级AppsFlyer SDK到最新版本
    确保你的项目依赖的是最新版的AppsFlyer SDK,旧版本可能没有做好Oreo的适配。在build.gradle(Module级别)中更新依赖:

    implementation 'com.appsflyer:af-android-sdk:6.+' // 建议使用最新稳定版,可到官网确认具体版本号
    
  3. 可选:动态注册广播接收器
    如果静态注册还是有问题,可以在应用的Application类中动态注册广播接收器,这样能绕过Oreo的静态广播限制:

    public class MyApplication extends Application {
        @Override
        public void onCreate() {
            super.onCreate();
            // 动态注册INSTALL_REFERRER广播接收器
            IntentFilter referrerFilter = new IntentFilter("com.android.vending.INSTALL_REFERRER");
            registerReceiver(new AppsFlyerInstallReceiver(), referrerFilter);
        }
    }
    

    记得在AndroidManifest.xml中声明你的Application类:

    <application
        android:name=".MyApplication"
        ...>
        ...
    </application>
    

测试建议

修改完成后重新打包APK,在Galaxy S8+上用referrerSender工具重新测试,同时可以通过Logcat过滤AppsFlyer相关日志,确认广播是否被正常接收处理。

内容的提问来源于stack exchange,提问作者RenYuZhuo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 10:02:37