我在app app中有应用程序。我正在使用AndroidBillingLibrary来管理购买。
当我在调试模式下运行应用程序时,我希望能够访问所有可购买的选项。
目前,当我需要测试一个选项时,我会替换这样的东西:
bool option = BillingController.isPurchased(this,OPTION_NAME);
通过
bool option = true;//BillingController.isPurchased(this,OPTION_NAME);
显然不是一个好的解决方案!
这样的东西安全吗? :
public class MyApp extends Application {
public static final bool DEBUG = true;
}
if(MyApp.DEBUG)
option = true;
else
option = BillingController.isPurchased(this,OPTION_NAME);
有没有更好的解决方案? 感谢
答案 0 :(得分:0)
使用应用程序信息服务获取调试值。
boolean DEBUG = (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));