我可以从应用程序 A 查询 Android Market 许可证服务器,以查看应用程序 B 是否是从市场合法购买的?
我有免费的应用程序 A。我有应用程序 B,它是一个捐赠应用程序。我知道人们宁愿花 4 美元买咖啡,然后通过其他渠道免费获得我的应用程序,但是哦,好吧。
如果应用程序 B 是合法的且来自市场且已付费,我想在应用程序 A 中启用更多功能。
因此,我很好奇是否只是更改市场许可证代码中的包名称,以便检查应用程序 B,即使应用程序 A 正在执行它。
例如,这一行来自 lvl 库代码:
mChecker = new LicenseChecker(ctx, new ServerManagedPolicy(ctx,
new AESObfuscator(SALT, ctx.getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
我想将 ctx.getPackageName() 替换为应用程序 B 中的包名称,这当然是我的应用程序,我知道。例如:
mChecker = new LicenseChecker(ctx, new ServerManagedPolicy(ctx,
new AESObfuscator(SALT, com.something.app.b, deviceId)),
BASE64_PUBLIC_KEY);
有人有这方面的经验吗?
I have app A which is free. I have app B which is a donation app. I know people rather pay 4 bucks for coffee and get my app for free via other channels but oh well.
I want to enable more features in app A if app B is legit and from the market and paid for.
So I was curious if I just change the package name in the Market License code in order to check for app B even though app A is executing it.
For example, this line is from the lvl library code:
mChecker = new LicenseChecker(ctx, new ServerManagedPolicy(ctx,
new AESObfuscator(SALT, ctx.getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
I would like to replace ctx.getPackageName() with the package name from app B, which of course is my app and I know. For example:
mChecker = new LicenseChecker(ctx, new ServerManagedPolicy(ctx,
new AESObfuscator(SALT, com.something.app.b, deviceId)),
BASE64_PUBLIC_KEY);
Does anyone have experience with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更改混淆器构造函数的参数不会达到您想要的效果。检查的包由 LicenseChecker 构造函数的第一个参数确定。为 LicenseChecker 定义一个新的构造函数可能会起作用,该构造函数采用包 B 的包名称和版本代码。
如果应用程序 A 也想检查自己的许可证,则还需要扩展 ServerManagedPolicy,以便为应用程序 A 保留单独的缓存数据。应用程序 A 的首选项文件中的每个应用程序。
请注意,即使这有效,如果您在市场上更新应用程序 B,它也会崩溃,因为您需要将特定版本代码连接到应用程序 A 中。
Changing the arguments to the obfuscator constructor isn't going to do what you want. The package that is checked is determined by the LicenseChecker constructor from the first argument. It might work to define a new constructor for LicenseChecker that takes a package name and version code for package B.
If app A also wants to check its own license, you'll need to extend ServerManagedPolicy as well so that it keeps separate cache data for each app in app A's preferences file.
Note that even if this works, it will break if you update app B in the market, because you will need to wire in a specific version code into app A.