Skip to content

Commit dd9e419

Browse files
authored
Merge pull request #48 from SecUSo/development
Fix: Receiver lead to crashes on API 34+
2 parents e852cf2 + 8062cb6 commit dd9e419

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

app/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ android {
3232
kotlin {
3333
jvmToolchain(17)
3434
}
35-
lintOptions {
36-
checkReleaseBuilds true
37-
// Or, if you prefer, you can continue to check for errors in release builds,
38-
// but continue the build even when errors are found:
39-
abortOnError false
40-
}
4135
lint {
4236
lintConfig = file("lint.xml")
4337
}

app/lint.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<lint>
3+
<!-- Set the severity of missing translations to warning instead of error -->
4+
<issue id="MissingTranslation" severity="warning" />
5+
<issue id="MissingQuantity" severity="warning" />
6+
</lint>

app/src/main/java/org/secuso/privacyfriendlycircuittraining/activities/WorkoutActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ public void onResume() {
549549
timerService.setIsAppInBackground(false);
550550
}
551551
updateGUI();
552-
registerReceiver(timeReceiver, new IntentFilter(TimerService.COUNTDOWN_BROADCAST));
552+
ContextCompat.registerReceiver(this, timeReceiver, new IntentFilter(TimerService.COUNTDOWN_BROADCAST), ContextCompat.RECEIVER_EXPORTED);
553553
}
554554

555555
/**

app/src/main/java/org/secuso/privacyfriendlycircuittraining/services/TimerService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import android.widget.RemoteViews;
3131

3232
import androidx.core.app.NotificationCompat;
33+
import androidx.core.content.ContextCompat;
3334

3435
import org.secuso.privacyfriendlycircuittraining.R;
3536
import org.secuso.privacyfriendlycircuittraining.activities.WorkoutActivity;
@@ -115,7 +116,7 @@ public void onCreate() {
115116
this.restTimer = createRestTimer(this.startTime);
116117
this.workoutTimer = createWorkoutTimer(this.workoutTime);
117118

118-
registerReceiver(notificationReceiver, new IntentFilter(NOTIFICATION_BROADCAST));
119+
ContextCompat.registerReceiver(this, notificationReceiver, new IntentFilter(NOTIFICATION_BROADCAST), ContextCompat.RECEIVER_EXPORTED);
119120

120121
notiBuilder = new NotificationCompat.Builder(this);
121122
notiManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

0 commit comments

Comments
 (0)