Update android/app/src/main/java/tf/monochrome/music/BackgroundAudioPlugin.java

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
tryptz 2026-04-04 22:21:36 -04:00 committed by edideaur
parent b4db909d6a
commit 2dbd1aac7a

View file

@ -32,11 +32,16 @@ public class BackgroundAudioPlugin extends Plugin {
}
}
@PluginMethod
`@PluginMethod`
public void stop(PluginCall call) {
Intent intent = new Intent(getContext(), AudioPlaybackService.class);
intent.setAction("STOP");
getContext().stopService(intent);
call.resolve();
try {
Intent intent = new Intent(getContext(), AudioPlaybackService.class);
intent.setAction("STOP");
// Use startService so onStartCommand receives the STOP action
getContext().startService(intent);
call.resolve();
} catch (Exception e) {
call.reject("Failed to stop audio service: " + e.getMessage(), e);
}
}
}