Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Don't get Android Market INSTALL_REFERRER on Android 3.x

I implemented a BroadcastReceiver for the Android Market INSTALL_REFERRER Intent as described here:

Get referrer after installing app from Android Market

It works fine for android devices earlier than 3.0 but it never seems to fire on Honeycomb devices. I've checked the logcat output during the install and after the app's first launch and I don't see any of my debug output which leads me to believe that the BroadcastReceiver isn't being run (I do see the output on pre-Honeycomb versions).

Can anyone out there confirm this problem?

Any idea how to make it work?

like image 776
Some Coder Avatar asked Aug 08 '11 17:08

Some Coder


2 Answers

There's a new flag called FLAG_EXCLUDE_STOPPED_PACKAGES in 3.1:

If set, this intent will not match any components in packages that are currently stopped. If this is not set, then the default behavior is to include such applications in the result.

From the release notes for 3.1:

Note that the system adds FLAG_EXCLUDE_STOPPED_PACKAGES to all broadcast intents.

And also:

Applications are in a stopped state when they are first installed but are not yet launched and when they are manually stopped by the user (in Manage Applications).

Seems like this is breaking the behavior of INSTALL_REFERRER in 3.1+ devices as your app has not yet been launched and so can not receive the broadcast. Sadly I don't know of any way to make this work. Google could probably do something to fix this in their Market app (one way would be to just use FLAG_INCLUDE_STOPPED_PACKAGES though I'm not sure that would be a great idea, given the whole point of these new launch controls).

like image 188
kabuko Avatar answered Oct 13 '22 09:10

kabuko


As i experienced the Broadcast Intent *INSTALL_REFERRER* is fired once before the Application is launched the first time If you don't catch it there, you'll never get it again

like image 37
martyglaubitz Avatar answered Oct 13 '22 09:10

martyglaubitz