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) { public void stop(PluginCall call) {
Intent intent = new Intent(getContext(), AudioPlaybackService.class); try {
intent.setAction("STOP"); Intent intent = new Intent(getContext(), AudioPlaybackService.class);
getContext().stopService(intent); intent.setAction("STOP");
call.resolve(); // 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);
}
} }
} }