Skip to content

Commit

Permalink
Merge branch 'bootfix' of https://github.com/DDRBoxman/MPD
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKellermann committed Dec 27, 2023
2 parents a4c7041 + 3d8e285 commit bd408cd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ android {
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_9
targetCompatibility = JavaVersion.VERSION_1_9
}
}

Expand Down
3 changes: 3 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>

<service
Expand Down
10 changes: 9 additions & 1 deletion android/app/src/main/java/org/musicpd/Receiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@
import android.content.Intent;
import android.util.Log;

import java.util.Set;

public class Receiver extends BroadcastReceiver {

private static final Set<String> BOOT_ACTIONS = Set.of(
"android.intent.action.BOOT_COMPLETED",
"android.intent.action.QUICKBOOT_POWERON"
);

@Override
public void onReceive(Context context, Intent intent) {
Log.d("Receiver", "onReceive: " + intent);
if (intent.getAction() == "android.intent.action.BOOT_COMPLETED") {
if (BOOT_ACTIONS.contains(intent.getAction())) {
if (Settings.Preferences.getBoolean(context,
Settings.Preferences.KEY_RUN_ON_BOOT,
false)) {
Expand Down

0 comments on commit bd408cd

Please sign in to comment.