question: @ SuppressLint ( "NewApi" ) public void checkAndShow ( ) { if ( ! Utils . isGooglePlayInstalled ( activity ) ) { if ( debug ) LogD ( "Play Store is not installed. Won't do anything" ) ; return ; } if ( debug ) LogD ( "Last crash: " + ( ( System . currentTimeMillis ( ) - settings . getLong ( KEY_LAST_CRASH , 0L ) ) / 1000 ) + " seconds ago" ) ; if ( ( System . currentTimeMillis ( ) - settings . getLong ( KEY_LAST_CRASH , 0L ) ) < pauseAfterCrash ) { if ( debug ) LogD ( "A recent crash avoids anything to be done." ) ; return ; } if ( settings . getLong ( KEY_MONITOR_TOTAL , 0L ) < minimumMonitoringTime ) { if ( debug ) LogD ( "Monitor time not reached. Nothing will be done" ) ; return ; } if ( ! Utils . isOnline ( activity ) ) { if ( debug ) LogD ( "Device is not online. AppRate try to show up next time." ) ; return ; } if ( ! incrementViews ( ) ) { return ; } if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . GINGERBREAD ) { Date installDate = Utils . installTimeFromPackageManager ( activity . getPackageManager ( ) , this . packageName ) ; if ( installDate == null ) { installDate = Utils . installTimeFromPackageManager ( activity . getPackageManager ( ) , activity . getPackageName ( ) ) ; } Date now = new Date ( ) ; if ( now . getTime ( ) - installDate . getTime ( ) < installedSince ) { if ( debug ) LogD ( "Date not reached. Time elapsed since installation (in sec.): " + ( now . getTime ( ) - installDate . getTime ( ) ) ) ; return ; } } if ( ! settings . getBoolean ( KEY_ELAPSED_TIME , false ) ) { editor . putBoolean ( KEY_ELAPSED_TIME , true ) ; if ( debug ) LogD ( "First time after the time is elapsed" ) ; if ( settings . getInt ( KEY_COUNT , 5 ) > initialLaunchCount ) { if ( debug ) LogD ( "Initial count passed. Resetting to initialLaunchCount" ) ; editor . putInt ( KEY_COUNT , initialLaunchCount ) ; } commitEditor ( ) ; } boolean clicked = settings . getBoolean ( KEY_CLICKED , false ) ; if ( clicked ) return ; int count = settings . getInt ( KEY_COUNT , 0 ) ; if ( count == initialLaunchCount ) { if ( debug ) LogD ( "initialLaunchCount reached" ) ; showAppRate ( ) ; } else if ( policy == RetryPolicy . INCREMENTAL && count % initialLaunchCount == 0 ) { if ( debug ) LogD ( "initialLaunchCount incremental reached" ) ; showAppRate ( ) ; } else if ( policy == RetryPolicy . EXPONENTIAL && count % initialLaunchCount == 0 && Utils . isPowerOfTwo ( count / initialLaunchCount ) ) { if ( debug ) LogD ( "initialLaunchCount exponential reached" ) ; showAppRate ( ) ; } else { if ( debug ) LogD ( "Nothing to show. initialLaunchCount: " + initialLaunchCount + " - Current count: " + count ) ; } }
target:  Check and show if showing the view is needed