diff --git a/android/src/main/java/changjoopark/com/flutter_foreground_plugin/FlutterForegroundPlugin.java b/android/src/main/java/changjoopark/com/flutter_foreground_plugin/FlutterForegroundPlugin.java index f68f438..01558ff 100644 --- a/android/src/main/java/changjoopark/com/flutter_foreground_plugin/FlutterForegroundPlugin.java +++ b/android/src/main/java/changjoopark/com/flutter_foreground_plugin/FlutterForegroundPlugin.java @@ -119,7 +119,7 @@ public void onMethodCall(MethodCall call, Result result) { private void launchForegroundService(String icon, int color, String title, String content, String subtext, Boolean chronometer, Boolean stopAction, String stopIcon, String stopText) { - Intent intent = new Intent(activity, FlutterForegroundService.class); + Intent intent = new Intent(context, FlutterForegroundService.class); intent.setAction(START_FOREGROUND_ACTION); intent.putExtra("icon", icon); intent.putExtra("color", color); @@ -158,7 +158,7 @@ private void stopForegroundService() { Intent intent = new Intent(context, FlutterForegroundService.class); intent.setAction(STOP_FOREGROUND_ACTION); - activity.startService(intent); + context.startService(intent); callbackChannel.invokeMethod("onStopped", null); }