开发者

Extending broadcastReceiver and tracking Google Analytics INSTALL_REFERRER

I'm having an issue with overriding the android BroadcastReceiver class in reference to android's INSTALL_REFERRER.

Instead of calling the google analytics receiver directly from my android manifest.xml, I'm calling a custom broadcast receiver, and then passing it on to Google Analytics. I need to know where my referrals are coming from in Google Analytics and also make use of the broadcast receiver by firing it to 3rd parties driving traffic to my app.

Below is some example code from my broadcast receiver and android manifest file.

package com.sigmyers.broadcastExample;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.google.android.apps.analytics.AnalyticsReceiver;
import com.mdotm.MdotmReceiver;

public class TestReceiver extends BroadcastReceiver
{

    @Override
    public void onReceive(Context context, Intent intent)
    {
        AnalyticsReceiver googleAnalyticsReceiver = new AnalyticsReceiver();
        googleAnalyticsReceiver.onReceive(context, intent);

        MdotmReceiver mdotmReceiver = new MdotmReceiver();
        mdotmReceiver.onReceive(context, intent);
    }
}

My Android Manifest xml file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.sigmyers.broadcastExample"
      android:versionCode="10"
      android:versionName="1.9">
    <uses-sdk android:minSdkVersion="4"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <application android:label="@string/app_name" android:icon="@drawable/icon">
        <activity android:name="MyActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <receiver android:name="com.sigmyers.broadcastExample.TestReceiver" android:exported="true">
          <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
          </intent-filter>
        </receiver>
    </application>
</manifest> 

The weird thing is that mDotM is reporting referrals just fine when generating URL's with the form at the bottom of the following URL: http://code.google.com/mobile/analytics/docs/android/#referrals

Nothing, howe开发者_C百科ver, is ever being populated in GoogleAnalytics (aside from tracking data elsewhere in the app, but never the install_referrer). Is there something I'm missing or forgot to do?

When debugging my app after downloading from the android app store, I always see that Google Analytics throws an error of some sort, causing it to not fire, but I feel like calling the onReceive method, as described by Google / Ad Mob, is all that is required to get the Install referrer passed along properly.

Any clues out there on Stack Overflow??

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜