Initial Configuration for Android App

2019-07-11 21:02发布

问题:

Is it possible to have some piece of data passed in to the app on the very first app run through via the Google Play link (maybe as an Intent).

The scenario I envision is this:

  1. I share a special url to my app in the market for special clients (promotion, etc)
  2. They download the app, install the app.
  3. On the first run, I can pull off the data I put on the url somehow
  4. Magic happens

Current Solution

My current solution to this problem is sending out a generic link to the market, and have a second url that they click that my app has an intent-filter. I'd really like to have only one url for people to click.

Thoughts

An alternative I've considered, is having the link go to my server, save some unique information about the HTTP Request, then try to correlate that information with a web request on the first app run, but that seems very error prone (IP isn't unique on Wi-Fi behind a NAT, User Agents don't match...).

Any advice would be greatly appreciated.

回答1:

Have a search for the com.android.vending.INSTALL_REFERRER Intent. This source, for example, says:

Starting with Android 1.6, the Android Market's emits a broadcast Intent named com.android.vending.INSTALL_REFERRER whenever certain parameters are added to the market url. Note that web version of the Market also passes these parameters to your devices upon install.

I have no idea how up-to-date or well-supported that is, but it sounds like what you want.



回答2:

I think you can do it with an APK expasition file:

http://developer.android.com/google/play/expansion-files.html