diff --git a/android/app/build.gradle b/android/app/build.gradle index 4f34b71..f278bf0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -11,8 +11,8 @@ android { applicationId "com.vernu.sms" minSdk 24 targetSdk 32 - versionCode 13 - versionName "2.6.0" + versionCode 14 + versionName "2.6.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/android/app/src/main/java/com/vernu/sms/services/StickyNotificationService.java b/android/app/src/main/java/com/vernu/sms/services/StickyNotificationService.java index 6a82579..e58b760 100644 --- a/android/app/src/main/java/com/vernu/sms/services/StickyNotificationService.java +++ b/android/app/src/main/java/com/vernu/sms/services/StickyNotificationService.java @@ -21,7 +21,6 @@ import com.vernu.sms.helpers.SharedPreferenceHelper; public class StickyNotificationService extends Service { private static final String TAG = "StickyNotificationService"; - private final BroadcastReceiver receiver = new SMSBroadcastReceiver(); @Override public IBinder onBind(Intent intent) { @@ -34,7 +33,7 @@ public class StickyNotificationService extends Service { super.onCreate(); Log.i(TAG, "Service Started"); - // Only register receiver and show notification if enabled in preferences + // Only show notification if enabled in preferences boolean stickyNotificationEnabled = SharedPreferenceHelper.getSharedPreferenceBoolean( getApplicationContext(), AppConstants.SHARED_PREFS_STICKY_NOTIFICATION_ENABLED_KEY, @@ -42,11 +41,6 @@ public class StickyNotificationService extends Service { ); if (stickyNotificationEnabled) { - IntentFilter filter = new IntentFilter(); - filter.addAction(Telephony.Sms.Intents.SMS_RECEIVED_ACTION); - filter.addAction(android.telephony.TelephonyManager.ACTION_PHONE_STATE_CHANGED); - registerReceiver(receiver, filter); - Notification notification = createNotification(); startForeground(1, notification); Log.i(TAG, "Started foreground service with sticky notification"); @@ -65,17 +59,6 @@ public class StickyNotificationService extends Service { public void onDestroy() { super.onDestroy(); - // Only unregister if we had registered in the first place - boolean stickyNotificationEnabled = SharedPreferenceHelper.getSharedPreferenceBoolean( - getApplicationContext(), - AppConstants.SHARED_PREFS_STICKY_NOTIFICATION_ENABLED_KEY, - false - ); - - if (stickyNotificationEnabled) { - unregisterReceiver(receiver); - } - Log.i(TAG, "StickyNotificationService destroyed"); }