bump min sdk to 24

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/27/head
androidacy-user 3 years ago
parent 8619c66624
commit 24ec7f6cc6

@ -32,7 +32,7 @@ android {
defaultConfig {
applicationId "com.fox2code.mmm"
minSdk 23
minSdk 24
targetSdk 33
versionCode 64
versionName "1.2.1"

@ -14,7 +14,6 @@ import android.util.Log;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.StyleRes;
import androidx.core.app.NotificationManagerCompat;
import androidx.emoji2.text.DefaultEmojiCompatConfig;
@ -58,7 +57,7 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
// Warning! Locales that are't exist will crash the app
// Anything that is commented out is supported but the translation is not complete to at least 60%
public static HashSet<String> supportedLocales = new HashSet<>();
private static Locale timeFormatLocale = Resources.getSystem().getConfiguration().locale;
private static Locale timeFormatLocale = Resources.getSystem().getConfiguration().getLocales().get(0);
private static SimpleDateFormat timeFormat = new SimpleDateFormat(timeFormatString, timeFormatLocale);
private static SharedPreferences bootSharedPreferences;
private static String relPackageName = BuildConfig.APPLICATION_ID;
@ -308,6 +307,7 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
Log.d("MainApplication", "Starting FoxMMM version " + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + "), commit " + BuildConfig.COMMIT_HASH);
}
super.onCreate();
if (BuildConfig.DEBUG) {
Log.d("MainApplication", "FoxMMM is running in debug mode");
}
@ -390,7 +390,7 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
Locale newTimeFormatLocale = newConfig.locale;
Locale newTimeFormatLocale = newConfig.getLocales().get(0);
if (timeFormatLocale != newTimeFormatLocale) {
timeFormatLocale = newTimeFormatLocale;
timeFormat = new SimpleDateFormat(timeFormatString, timeFormatLocale);
@ -398,17 +398,14 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
super.onConfigurationChanged(newConfig);
}
@RequiresApi(api = Build.VERSION_CODES.N)
public void clearAppData() {
// Clear app data
try {
// Clearing app data
// We have to manually delete the files and directories
// because the cache directory is not cleared by the following method
File cacheDir = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
File cacheDir;
cacheDir = this.getDataDir();
}
if (cacheDir != null && cacheDir.isDirectory()) {
String[] children = cacheDir.list();
if (children != null) {

@ -2,9 +2,11 @@ package com.fox2code.mmm.utils.sentry;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import com.fox2code.mmm.CrashHandler;
import com.fox2code.mmm.MainApplication;
import com.fox2code.mmm.androidacy.AndroidacyUtil;
@ -35,10 +37,12 @@ public class SentryMain {
editor.putString("lastExitReason", "crash");
editor.putLong("lastExitTime", System.currentTimeMillis());
editor.apply();
// If we just let the default uncaught exception handler handle the
// exception, the app will hang and never close.
// So we need to kill the app ourselves.
System.exit(1);
// open crash handler and exit
Intent intent = new Intent(mainApplication, CrashHandler.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mainApplication.startActivity(intent);
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(10);
});
SentryAndroid.init(mainApplication, options -> {
// If crash reporting is disabled, stop here.

Loading…
Cancel
Save