Send INSTALL_REFERRER message from app

I want to emulate google play com.android.vending.INSTALL_REFERRER transmission.

My app installing another app, when the installation is finished, I want to broadcast INSTALL_REFERRER like google play, so the installed app will send the campaign data to google analytics.

I followed all the Google Analytics tutorials and looked at this implementation: https://github.com/giago/referraltester

When sending a broadcast from the ADB wrapper, everything works fine, the analytics receiver is getting the data and sending it to Google Analytics, so sending it from the app seems to be unworkable.

This is what I get when I pass INSTALL_REFERRER from my application:

Subject [GAThread, 5, main]: No campaign data found.

Broadcasting application:

Intent i = new Intent("com.android.vending.INSTALL_REFERRER");
        i.setPackage("com.dev.refferer2");
        i.putExtra("referrer",
            "utm_source=apps&utm_medium=apps&utm_term=apps&utm_content=apps&utm_campaign=apps");
        sendBroadcast(i);

      

the application receiving the broadcast: Manifest.xml:

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

      

applications:

 synchronized Tracker getTracker(TrackerName trackerId) {
    if (!mTrackers.containsKey(trackerId)) {

        GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
        Tracker t = (trackerId == TrackerName.APP_TRACKER) ? analytics.newTracker(R.xml.global_tracker)
                : (trackerId == TrackerName.GLOBAL_TRACKER) ? analytics.newTracker(R.xml.global_tracker)
                : analytics.newTracker(R.xml.global_tracker);

        mTrackers.put(trackerId, t);

    }
    return mTrackers.get(trackerId);
}

      

MyActivity:

    Tracker t = ((App) getApplication()).getTracker(App.TrackerName.APP_TRACKER);
    t.setScreenName("MyActivity");
    t.send(new HitBuilders.AppViewBuilder().build());

      

please help me to solve this problem. is it even possible or am I wasting my time here?

thank!!:)

+3


source to share





All Articles