protected static boolean fetchAnonymousAccessTokenIfNeeded ( final String userId , final ResponseHandler onFetchedHandler ) { if ( ! WonderPush . isInitialized ( ) ) { // Note: Could use WonderPush.safeDefer() here but as we require consent to proceed, // let's use WonderPush.safeDeferWithConsent() to additionally passively wait for SDK initialization. WonderPush . safeDeferWithConsent ( new Runnable ( ) { @ Override public void run ( ) { if ( ! fetchAnonymousAccessTokenIfNeeded ( userId , onFetchedHandler ) ) { // Call the handler anyway onFetchedHandler . onSuccess ( null ) ; } } } , null ) ; return true ; // true: the handler will be called } if ( null == WonderPushConfiguration . getAccessToken ( ) ) { fetchAnonymousAccessToken ( userId , onFetchedHandler ) ; return true ; } return false ; }
If no access token is found in the user s preferences fetch an anonymous access token .