运动检测与自己的BroadcastReceiver自己的、BroadcastReceiver

2023-09-06 09:02:46 作者:人生很短,更要吃好睡好玩好,做个酷酷的小女子。适合女生用的酷

我有一个Android应用程序,其中用户必须注册。在发送的注册,我想从 PlayStore (utm_source和等)发送的参数就知道从哪个竞选用户得来的。

I've an Android app where user has to register. On sending registration, I want to send the parameters from the PlayStore (utm_source, etc.) to know from which campaign user comes from.

这样的想法是用自己的的BroadcastReceiver 的INSTALL_REFERRER,我在那里保存 参数到一个文件。当用户注册,我将读取该文件并发送的内容。

So the idea was to use a own BroadcastReceiver for INSTALL_REFERRER, where I save parameters to a file. When user registers i will read the file and send the content.

所以我做了接收器:

public class CampaignBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {


    String refferer = intent.getExtras().getString("referrer");
    try {
        FileOutputStream fos = context.openFileOutput("campaign", Context.MODE_PRIVATE);
        fos.write(refferer.getBytes());
        fos.close();
    } catch (FileNotFoundException e) {

    } catch (IOException e) {

    }


    new CampaignTrackingReceiver().onReceive(context, intent);
}

和,在AndroidManifest.xml中我使用:

And, in AndroidManifest.xml I use :

<service android:name="com.google.analytics.tracking.android.CampaignTrackingService"/>
    <receiver android:name=".receiver.CampaignBroadcastReceiver" android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

在我使用的测试场景,从谷歌它的工作原理,并在我的BroadcastReceiver中的onReceive方法被调用。

When i use the test scenario from google it works and the onReceive Method in my BroadcastReceiver is called.

./adb shell am  broadcast -a com.android.vending.INSTALL_REFERRER -n
mypackage/mypackage.receiver.CampaignBroadcastReceiver --es  "referrer" 
"utm_source%3Dtest%26utm_medium%3Dbanner%26utm_term%3Dmailstuff"

但是,当我从 PlayStore 尝试一下然后就没有被调用。

But, when I try it from PlayStore then nothing is called.

有没有人知道如何在应用程序从 PlayStore 虎视眈眈的运动参数?

Has anybody idea how to grap the campaign parameters from the PlayStore in app?

推荐答案

我不知道一个解决办法,但问题是众所周知的谷歌。

I don't know a workaround but the issue is known to Google.

谷歌播放运动检测目前不支持   网络到设备安装来自网络播放存储发起的。

Google Play Campaign Measurement does not currently support web-to-device installs initiated from the web Play Store.

已知问题

 
精彩推荐
图片推荐