3

我已经研究这个主题几个小时了,我找不到任何有用的信息。所以最后我决定第一次创建一个 Stackoverflow 帐户。

基本上我有一个 Android 应用程序,它托管在一台服务器上,应用程序用户将从那里下载它。但是,该应用程序的链接将分发到许多不同的附属网站,每个网站都有我的系统已知的唯一 ID。

所以我想跟踪这些附属公司。应用程序需要知道用户在安装应用程序之前点击了哪个会员的链接。然后该应用程序会将会员编号传递给我们的服务器。

下载网址的示例将类似于:- http://myserver.com/apphosting?affiliate=777&app.apk

仅当您在 Google Play 上托管应用程序并允许您使用安装引荐来源网址时,Google 才支持此功能。我对么?

有没有办法解决这个问题?在我看来,这是一个非常罕见的问题。

提前致谢。我非常感谢您的帮助和您宝贵的几分钟时间。

4

1 回答 1

1

There are a few ways to go about this and to do them well they all involve a significant amount of effort.

  1. You could return a different APK for every affiliate URL. If you have a lot of different affiliates, you'd want to have a build system which would compile a unique APK for each based on what is mostly the same application but with a different values resource file which contains the different affiliate IDs (probably making the main application a library application). Whether you hook this up directly to the web site or just copy the output to the website is up to you. You can then have your app phone home using this value.
  2. You can do some form of device fingerprinting both on the download side and on the app launch side, and match up the fingerprints. The simplest reasonably accurate fingerprint would probably just consist of the IP address of the device. This has its limitations, however. Research has shown that:

    individual cell phones can expose different IP addresses to servers within time spans of a few minutes

You'll also find that multiple phones can share the same IP at the same time due to the NAT technology that many carriers use. Still, the first 13-16 bits of the IP are for the most part quite stable within a short time period. You can also gain some accuracy by examining HTTP headers, especially browser user agents. There are some problems that manifest there too but there's definitely useful information there.

As you are distributing this application yourself, I would favor the first approach fairly heavily. It gives you better accuracy and is (at least in my opinion) easier to implement (and yes I've implemented something along the lines of both of these solutions). The downside of course is that you'll be distributing many different versions of your app, but if you do it right you should have only very minimal differences between the APKs that will only slightly increase your support overhead.

于 2013-01-22T22:44:24.347 回答