Android 应用内结算常见问题

发布于 2024-10-26 12:45:05 字数 290 浏览 1 评论 0原文

我知道应用内计费是 Android 中的新功能,我想使用它,但版本要求让我三思是否值得付出努力。我非常感谢那些已经实施或使用过应用程序内结算的详细信息的人。

  1. 我还有 10% 1.5 用户。应用内计费至少需要 1.6 版本才能运行。这是否意味着 1.5 个用户会立即崩溃?如果不是,那么它在什么时候失败?我不想编写一堆 hacky 代码来与 1.5 用户保持兼容。
  2. 如果用户重新安装应用程序,是否会记住他们购买的应用程序?
  3. 如果您没有所需的市场版本,什么时候会失败?

谢谢。

I know In-App billing is new in Android and I would like to use it, but the version requirements make me think twice whether it's worth the effort. I would appreciate any input from those who have implemented or worked with In App Billing in detail.

  1. I still have 10% 1.5 users. In app billing requires at least 1.6 to work. Does that mean 1.5 users will crash immediately? If not, at what point does it fail? I don't want to write a bunch of hacky code to stay compatible with 1.5 users.
  2. If user reinstalls the app, are their app purchases remembered?
  3. At what point does it fail if you don't have the required Market version?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无尽的现实 2024-11-02 12:45:06

关于版本支持,您需要编写一些额外的代码来检测设备操作系统版本(请参阅 android.os.Build.VERSION),以便确保它可以在 1.5 设备上运行。我强烈建议将该代码隔离在其自己的类中,并且仅在版本检查后实例化该类。这样您的代码就可以保持干净(而不是“hacky”),并且您不会意外地从类字段引用 1.6+ 类。在我的代码中,我的版本测试类如下所示:

public class Android8 {
    private static final String TAG = "Android8";

    // public test variables
    public static final boolean IS_V8;
    public static final boolean AT_LEAST_V8;

    private static final Object pimpl;

    static {
        int sdk_int = 0;
        try {
            Field field = Build.VERSION.class.getField( "SDK" );
            String sdk_str = (String)field.get( null );
            sdk_int = Integer.parseInt( sdk_str );
        } catch( Throwable e ) {
        }

        IS_V8 = (sdk_int==8);
        AT_LEAST_V8 = (sdk_int>=8);

        if( AT_LEAST_V8 ) {
            pimpl = new Implementation();
        } else {
            pimpl = null;
        }
    }

    // Version safe interface
    public static void Camera_setDisplayOrientation( Camera camera, int degrees ) {
        if( AT_LEAST_V8 )
            ((Implementation)pimpl).Camera_setDisplayOrientation( camera, degrees );
    }

    // Will cause a verify error if loaded in a pre Android8 environment
    private static final class Implementation {
        public static void Camera_setDisplayOrientation( Camera camera, int degrees ) {
            camera.setDisplayOrientation( degrees );
        }
    }
}

Regarding version support, you'll have write some extra code to detect the device OS version (see android.os.Build.VERSION) so make sure it will run on 1.5 devices. I strongly suggest isolating that code in its own class, and only instantiate that class after your version check. That way your code stays clean (not "hacky") and you don't accidentally reference a 1.6+ class from a class field. In my code, I have version test classes that look like this:

public class Android8 {
    private static final String TAG = "Android8";

    // public test variables
    public static final boolean IS_V8;
    public static final boolean AT_LEAST_V8;

    private static final Object pimpl;

    static {
        int sdk_int = 0;
        try {
            Field field = Build.VERSION.class.getField( "SDK" );
            String sdk_str = (String)field.get( null );
            sdk_int = Integer.parseInt( sdk_str );
        } catch( Throwable e ) {
        }

        IS_V8 = (sdk_int==8);
        AT_LEAST_V8 = (sdk_int>=8);

        if( AT_LEAST_V8 ) {
            pimpl = new Implementation();
        } else {
            pimpl = null;
        }
    }

    // Version safe interface
    public static void Camera_setDisplayOrientation( Camera camera, int degrees ) {
        if( AT_LEAST_V8 )
            ((Implementation)pimpl).Camera_setDisplayOrientation( camera, degrees );
    }

    // Will cause a verify error if loaded in a pre Android8 environment
    private static final class Implementation {
        public static void Camera_setDisplayOrientation( Camera camera, int degrees ) {
            camera.setDisplayOrientation( degrees );
        }
    }
}
这个俗人 2024-11-02 12:45:06

问题 2:如果项目不受管理,则不可以。是的,如果是的话。
这就是托管商品的要点,让 Google 的服务器管理(记住)此类情况下购买的商品。

(如果您销售游戏关卡或应用程序功能等项目,“按用户帐户管理”购买类型非常有用。这些项目不是暂时的,通常需要在用户重新安装您的应用程序、擦除设备上的数据时恢复,或在新设备上安装您的应用程序。)

来自: http ://developer.android.com/guide/market/billing/billing_admin.html#billing-purchase-type

Question 2: NO, if items are UNMANAGED. Yes if they are.
That's the point with managed items, let's the Google's servers manage (remenber) the purchased items for this sort of cases.

(The "manage by user account" purchase type is useful if you are selling items such as game levels or application features. These items are not transient and usually need to be restored whenever a user reinstalls your application, wipes the data on their device, or installs your application on a new device.)

from: http://developer.android.com/guide/market/billing/billing_admin.html#billing-purchase-type

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文