i) 生成一个载有<代码>的广播接收器。 INSTALL_REFERRER 广播。
When I m installing the app with eclipse and creating a broadcast with adb I see that all work fine, the LogCat is displaying all that it should be. But when I m installing the app from the play store nothing is showing on the logcat. If I understand correctly, the play store app should create a broadcast witch the app that is being installed supposed to catch, right?
基本情况是:
public class SDK_Referrer extends BroadcastReceiver
{
public void onReceive(Context context, Intent intent)
{
if (intent.getAction().equals("com.android.vending.INSTALL_REFERRER"))
{
String referrer = intent.getStringExtra("referrer");
if (!(referrer == null || referrer.length() == 0))
{
// extracting the relevant data to Map
Log.d("SAMPLE", "Generating Ymid from referrel");
Map<String, String> referralmap =
createHashMapFromQueryString(referrer);
Log.d("SAMPLE", "Ymid is: " + referralmap.get("ymid"));
}
}
}
}
i only want to send someting to a server when the app is being installed. Thanks!