public static void start ( final GVRContext context , final String appId , final ResultListener listener ) { if ( null == listener ) { throw new IllegalArgumentException ( "listener cannot be null" ) ; } final Activity activity = context . getActivity ( ) ; final long result = create ( activity , appId ) ; if ( 0 != result ) { throw new IllegalStateException ( "Could not initialize the platform sdk; error code: " + result ) ; } context . registerDrawFrameListener ( new GVRDrawFrameListener ( ) { @ Override public void onDrawFrame ( float frameTime ) { final int result = processEntitlementCheckResponse ( ) ; if ( 0 != result ) { context . unregisterDrawFrameListener ( this ) ; final Runnable runnable ; if ( - 1 == result ) { runnable = new Runnable ( ) { @ Override public void run ( ) { listener . onFailure ( ) ; } } ; } else { runnable = new Runnable ( ) { @ Override public void run ( ) { listener . onSuccess ( ) ; } } ; } activity . runOnUiThread ( runnable ) ; } } } ) ; }
Starts asynchronous check . Result will be delivered to the listener on the main thread .