【问题标题】:What is 'action android:name="com.android.vending.INSTALL_REFERRER" '?什么是'action android:name="com.android.vending.INSTALL_REFERRER"'?
【发布时间】:2012-09-29 01:06:09
【问题描述】:

我已经测试了 Appbrain SDK 和 Inmobi SDK。 我找到了这个普通的接收器。我制作了定制接收器。 我认为在谷歌市场下载应用程序时,谷歌市场会向我的应用程序发送“推荐人”价值。但我什么都没收到。什么问题?

//This is Appbrain's receiver
<receiver android:exported="true" android:name="com.appbrain.ReferrerReceiver" >
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>


//This is Inmobi's receiver
<receiver android:name="com.inmobi.adtracker.androidsdk.IMAdTrackerInstallRefererReciever" android:exported="true"  >
   <intent-filter>
      <action android:name="com.android.vending.INSTALL_REFERRER" />
      <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
   </intent-filter>
</receiver>


//This is My Custom receiver
<receiver android:name="com.xgame.adproject2.TestReceiver" android:exported="true" >
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
</receiver>

// source
public class TestReceiver extends BroadcastReceiver{

    public static final String TAG = "TEST";

    String referrerString = "";

    @Override
    public final void onReceive(Context context, Intent intent) {

        Log.e(TAG, "11111111");

        if(intent.getAction().equals("com.android.vending.INSTALL_REFERRER")) {
           Bundle extras = intent.getExtras();
           referrerString = extras.getString("referrer");

           Log.e(TAG, "REFERRER: " + referrerString);
        }
    }
}

当关闭应用程序时,我在 android 网络浏览器中输入了这个 url。但是下载app后,没有收到referrer值。

https://play.google.com/store/apps/details?id=com.xgame.adproject2&referrer=utm_source%3Dcom.xgame.adproject2%26utm_medium%3Dgoogle%26utm_term%3Dbanner%26utm_campaign%3Dxgame

【问题讨论】:

  • 你能贴出你的接收代码吗?可能duplicated

标签: android referrer receiver


【解决方案1】:

需要注意的重要一点是,Android 市场/Google Play 只会将安装引荐来源网址发送给您在清单中定义的第一个接收者。所以在这种情况下,只有 AppLift 接收器会得到它。

有一种方法可以从 AppLift 接收器“转发”事件,如 JavaDoc 中所述:http://swisscodemonkeys.github.com/appbrain-sdk/javadoc/reference/com/appbrain/ReferrerReceiver.html

在您的情况下,您的清单应如下所示:

//This is Appbrain's receiver
<receiver android:exported="true" android:name="com.appbrain.ReferrerReceiver" >
    <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
    </intent-filter>
    <meta-data android:name="forward.inmobi" android:value="com.inmobi.adtracker.androidsdk.IMAdTrackerInstallRefererReciever" /> 
    <meta-data android:name="forward.custom" android:value="com.xgame.adproject2.TestReceiver" />
</receiver>

// Keep the execution of InMobi on connectivity change
<receiver android:name="com.inmobi.adtracker.androidsdk.IMAdTrackerInstallRefererReciever" android:exported="true" >
   <intent-filter>
      <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
   </intent-filter>
</receiver>

请注意,Android 问题跟踪器上可能值得一提的一个相关错误是:http://code.google.com/p/android/issues/detail?id=24119(它是关于从有机应用发现中带回引荐来源网址字符串,如果他们修复了这个问题,希望他们也会在以下情况下添加引荐来源网址字符串通过 Play 网站进行安装)。

【讨论】:

    【解决方案2】:

    很久以前,Android 市场会向您传递一个引导您安装的市场页面的引荐来源字符串。在某些时候谷歌停止了这一点。 你可以在http://productforums.google.com/forum/#!topic/android-market/F5TO9uE3WSA看到一个关于这个的话题

    现在,只有在打开市场应用程序时明确将 is 传递给市场应用程序时,您才能获得引荐来源网址字符串。例如,如果应用 A 有一个安装应用 B 的按钮,您可以传递一个引用字符串 market://details?id=B&referrer=A。它主要适用于想要衡量应用广告效果的广告网络

    【讨论】:

    • 感谢您的解释。我是这个uri的请求。 'market://details?id=com.xgame.adproject2&referrer=utm_source%3Dgoogle%26utm_medium%3Dgoogle%26utm_term%3Dbanner%26utm_campaign%3Dxgame' 并且成功了。
    猜你喜欢
    • 2011-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-13
    • 2012-07-26
    • 2017-08-01
    • 1970-01-01
    • 2022-11-04
    相关资源
    最近更新 更多