From 24c10fdddccf8050b8f6487154405c6cfedadce6 Mon Sep 17 00:00:00 2001
From: Alessandro Ferro <49845537+xfarrow@users.noreply.github.com>
Date: Mon, 24 Oct 2022 09:13:23 +0200
Subject: [PATCH] Night mode layout bug fixed
---
.../xfarrow/locatemydevice/SmsReceiver.java | 29 +++++++++++++++++--
src/app/src/main/res/layout/settings.xml | 2 --
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/src/app/src/main/java/com/xfarrow/locatemydevice/SmsReceiver.java b/src/app/src/main/java/com/xfarrow/locatemydevice/SmsReceiver.java
index 8b1df7d..0037373 100644
--- a/src/app/src/main/java/com/xfarrow/locatemydevice/SmsReceiver.java
+++ b/src/app/src/main/java/com/xfarrow/locatemydevice/SmsReceiver.java
@@ -12,10 +12,11 @@ import android.widget.Toast;
public class SmsReceiver extends BroadcastReceiver {
// https://www.vogella.com/tutorials/AndroidBroadcastReceiver/article.html
// This method gets fired as soon as it receives an SMS.
- // Consider using a JobService: https://developer.android.com/topic/performance/vitals/anr#slow_broadcast_receivers
@Override
public void onReceive(Context context, Intent intent) {
-
+ /* Consider using a WorkManager: https://developer.android.com/topic/performance/vitals/anr#slow_broadcast_receivers
+ * because the maximum BroadcastReceiver lifespan is 10seconds https://developer.android.com/training/articles/perf-anr.html
+ */
if (intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")) {
Bundle bundle = intent.getExtras();
if (bundle != null) {
@@ -45,4 +46,26 @@ public class SmsReceiver extends BroadcastReceiver {
}
}
}
-}
\ No newline at end of file
+}
+
+/*
+NOTE:
+On Android 3.1 and higher, when your app is first installed on the device, it is in a
+“stopped” state. This has nothing to do with onStop() of any activity. While in the
+stopped state, your manifest-registered BroadcastReceivers will not receive any
+broadcasts.
+To get out of the stopped state, something on the device, such as another app (that
+itself is not in the stopped state), must use an explicit Intent to invoke one of your
+components.
+The most common way this happens is for the user to tap on a launcher icon
+associated with your launcher activity. Under the covers, the home screen’s launcher
+will create an explicit Intent, identifying your activity, and use that with
+startActivity(). This moves you out of the stopped state.
+As noted above, you start off in the stopped state. Once you are moved out of the
+stopped state, via the explicit Intent, you will remain out of the stopped state until
+one of two things happens:
+1. The user uninstalls your app
+2. The user “force-stops” your app
+
+- The busy's guide to Android Development, Mark L. Murphy
+ */
\ No newline at end of file
diff --git a/src/app/src/main/res/layout/settings.xml b/src/app/src/main/res/layout/settings.xml
index 6b4d2d8..41464ad 100644
--- a/src/app/src/main/res/layout/settings.xml
+++ b/src/app/src/main/res/layout/settings.xml
@@ -21,7 +21,6 @@
android:textSize="17sp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
- android:textColor="@color/design_default_color_on_secondary"
android:text="Password" />