Android - 识别应用程序的重新安装

标签 android

我正在设计一个 Android 移动应用程序。 该应用程序使用信用系统。用户可以通过 Google 的应用计费服务购买积分。 此外,当用户安装该应用程序时,它会获得一些免费积分。

用户积分存储在网络服务器中。当用户下载应用程序时,会创建一个 UUID 并将其存储在应用程序和服务器中。

我需要以某种方式检测用户何时卸载应用程序并重新安装它,以便获得起始免费积分(重新安装将创建一个新的 UUID,因此它就像一个新用户)。

我一直在寻找电话或用户标识符,但我了解到这不是一个好主意(http://android-developers.blogspot.com.es/2011/03/identifying-app-installations.html Is there a unique Android device ID?How to find serial number of Android device?)。此外,为了使用不属于自己的帐户,这很容易被黑客入侵。

有办法解决这个问题吗?也许使用应用内计费? 我愿意接受任何解决方案。

谢谢

最佳答案

因为你是完全正确的(识别设备是无用的)我会使用谷歌用户帐户来实现人员识别:

http://developer.android.com/training/id-auth/identify.html

AccountManager accountManager = AccountManager.get(getApplicationContext());

Account[] accounts = accountManager.getAccountsByType("com.google");

for (Account a: accounts) {
    if (a.name.contains("@gmail.com")) {
        return a.name;
    }
}

这可能会很棘手,但可以让您从下载该应用程序的同一个 Google Play 帐户中识别重新安装。

关于Android - 识别应用程序的重新安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16197863/

相关文章:

java - 设置 WebView 的尺寸

java - 如何在 android studio 中以编程方式触发图像按钮

android - 在 ant for Android 中启用 `--multi-dex` 选项

android - 我如何获得动态 GridView android?

android - 在 Google Map API V2 的 MyLocation 中禁用中心按钮

android - 使用 Room、Dao 将数据输入数据库时​​出错

Android Studio - 如何创建显示在当前 View 上方的透明 View

android - 数组类型的自定义属性

安卓安全模式密码保护

android - 如何恢复 cordova 应用程序而不是重新启动