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

妖精的绣舞 提交于 2019-12-23 09:37:23

问题


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?


回答1:


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).




回答2:


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



来源:https://stackoverflow.com/questions/6985775/dont-get-android-market-install-referrer-on-android-3-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!