You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
Service.stopForeground(): actually cancel the notification
This commit is contained in:
@@ -7,6 +7,8 @@ import android.os.IBinder;
|
|||||||
|
|
||||||
public abstract class Service extends ContextWrapper {
|
public abstract class Service extends ContextWrapper {
|
||||||
|
|
||||||
|
private int notification_id;
|
||||||
|
|
||||||
/* HACK for InputMethodService */
|
/* HACK for InputMethodService */
|
||||||
public Service(Context baseContext) {
|
public Service(Context baseContext) {
|
||||||
super(baseContext);
|
super(baseContext);
|
||||||
@@ -33,14 +35,17 @@ public abstract class Service extends ContextWrapper {
|
|||||||
|
|
||||||
public void startForeground(int id, Notification notification) {
|
public void startForeground(int id, Notification notification) {
|
||||||
System.out.println("startForeground(" + id + ", " + notification + ") called");
|
System.out.println("startForeground(" + id + ", " + notification + ") called");
|
||||||
|
this.notification_id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopForeground(boolean remove) {
|
public void stopForeground(boolean remove) {
|
||||||
System.out.println("stopForeground(" + remove + ") called");
|
System.out.println("stopForeground(" + remove + ") called");
|
||||||
|
if (remove)
|
||||||
|
new NotificationManager().cancel(notification_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopForeground(int remove) {
|
public void stopForeground(int remove) {
|
||||||
System.out.println("stopForeground(" + remove + ") called");
|
stopForeground(remove == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Application getApplication() {
|
public Application getApplication() {
|
||||||
|
|||||||
Reference in New Issue
Block a user