General questions about billing via the Android app


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?


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 );