@ MainThread public void startSetup ( ) { try { LOGGER . debug ( "Starting in-app billing setup." ) ; billingClient = BillingClient . newBuilder ( AbstractApplication . get ( ) ) . setListener ( this ) . build ( ) ; Runnable runnable = new Runnable ( ) { @ Override public void run ( ) { LOGGER . debug ( "In-app billing setup successful." ) ; for ( ProductType productType : InAppBillingAppModule . get ( ) . getInAppBillingContext ( ) . getManagedProductTypes ( ) ) { inventory . addProduct ( new Product ( productType ) ) ; } if ( isSubscriptionsSupported ( ) ) { for ( ProductType productType : InAppBillingAppModule . get ( ) . getInAppBillingContext ( ) . getSubscriptionsProductTypes ( ) ) { inventory . addProduct ( new Product ( productType ) ) ; } } if ( listener != null ) { listener . onSetupFinished ( ) ; } } } ; if ( isServiceConnected ) { runnable . run ( ) ; } else { startServiceConnection ( runnable ) ; } } catch ( Exception e ) { AbstractApplication . get ( ) . getExceptionHandler ( ) . logHandledException ( e ) ; if ( listener != null ) { listener . onSetupFailed ( new UnexpectedException ( e ) ) ; } } }
Starts the setup process . This will start up the setup process asynchronously . You will be notified through the listener when the setup process is complete .