This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity | |
implements ForceUpdateChecker.OnUpdateNeededListener { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
ForceUpdateChecker.with(this).onUpdateNeeded(this).check(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ForceUpdateChecker { | |
private static final String TAG = ForceUpdateChecker.class.getSimpleName(); | |
public static final String KEY_UPDATE_REQUIRED = "force_update_required"; | |
public static final String KEY_CURRENT_VERSION = "force_update_current_version"; | |
public static final String KEY_UPDATE_URL = "force_update_store_url"; | |
private OnUpdateNeededListener onUpdateNeededListener; | |
private Context context; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class App extends Application { | |
private static final String TAG = App.class.getSimpleName(); | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
final FirebaseRemoteConfig firebaseRemoteConfig = FirebaseRemoteConfig.getInstance(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class App extends Application { | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
Timber.plant(BuildConfig.DEBUG | |
? new Timber.DebugTree() | |
: new CrashReportingTree()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
// throw exception | |
throwException(); | |
} catch (Exception e) { | |
Timber.e(e.getMessage); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
// throw exception | |
throwException(); | |
} catch (Exception e) { | |
// Crashlytics | |
Crashlytics.logException(e); | |
// Firebase Crash Reporting | |
FirebaseCrash.logcat(Log.ERROR, TAG, e.getMessage()); | |
FirebaseCrash.report(e); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RandomGenerator { | |
private OnNumberGeneratedListener listener; | |
public RandomGenerator() { | |
} | |
public OnNumberGeneratedListener getListener() { | |
return listener; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
RandomGenerator randomGenerator = new RandomGenerator(); | |
randomGenerator.setListener(new OnNumberGeneratedListener() { | |
@Override | |
public void onNumberGenerated(int number) { | |
System.out.println(number); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface OnNumberGeneratedListener { | |
void onNumberGenerated(int number); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
RandomGenerator randomGenerator = new RandomGenerator(); | |
while(true) { | |
scanner.nextLine(); | |
int number = randomGenerator.getNumber(); | |
System.out.println(number); | |
} | |