Set ongoing flag for notifications that needs to be
This commit is contained in:
parent
89941db572
commit
33caa7ce92
6 changed files with 16 additions and 8 deletions
|
@ -186,7 +186,7 @@ public final class LinphoneService extends Service {
|
|||
return START_STICKY;
|
||||
}
|
||||
|
||||
mLinphoneManager = new LinphoneManager(this);
|
||||
mLinphoneManager = new LinphoneManager(getApplicationContext());
|
||||
sInstance = this; // sInstance is ready once linphone manager has been created
|
||||
|
||||
mNotificationManager = new NotificationsManager(this);
|
||||
|
|
|
@ -114,6 +114,7 @@ class ApiTwentyFourPlus {
|
|||
.setPriority(Notification.PRIORITY_HIGH)
|
||||
.setWhen(System.currentTimeMillis())
|
||||
.setShowWhen(true)
|
||||
.setOngoing(true)
|
||||
.setColor(context.getColor(R.color.notification_led_color))
|
||||
.addAction(getCallDeclineAction(context, callId));
|
||||
|
||||
|
|
|
@ -107,7 +107,8 @@ class ApiTwentyOnePlus {
|
|||
int level,
|
||||
Bitmap largeIcon,
|
||||
PendingIntent intent,
|
||||
int priority) {
|
||||
int priority,
|
||||
boolean ongoing) {
|
||||
Notification notif;
|
||||
|
||||
if (largeIcon != null) {
|
||||
|
@ -128,6 +129,7 @@ class ApiTwentyOnePlus {
|
|||
.setWhen(System.currentTimeMillis())
|
||||
.setPriority(priority)
|
||||
.setShowWhen(true)
|
||||
.setOngoing(ongoing)
|
||||
.build();
|
||||
} else {
|
||||
notif =
|
||||
|
|
|
@ -165,6 +165,7 @@ class ApiTwentySixPlus {
|
|||
.setPriority(Notification.PRIORITY_HIGH)
|
||||
.setWhen(System.currentTimeMillis())
|
||||
.setShowWhen(true)
|
||||
.setOngoing(true)
|
||||
.setColor(context.getColor(R.color.notification_led_color))
|
||||
.addAction(ApiTwentyFourPlus.getCallDeclineAction(context, callId));
|
||||
|
||||
|
@ -182,7 +183,8 @@ class ApiTwentySixPlus {
|
|||
int level,
|
||||
Bitmap largeIcon,
|
||||
PendingIntent intent,
|
||||
int priority) {
|
||||
int priority,
|
||||
boolean ongoing) {
|
||||
|
||||
if (largeIcon != null) {
|
||||
return new Notification.Builder(
|
||||
|
@ -197,6 +199,7 @@ class ApiTwentySixPlus {
|
|||
.setPriority(priority)
|
||||
.setWhen(System.currentTimeMillis())
|
||||
.setShowWhen(true)
|
||||
.setOngoing(ongoing)
|
||||
.setColor(context.getColor(R.color.notification_led_color))
|
||||
.build();
|
||||
} else {
|
||||
|
|
|
@ -88,7 +88,7 @@ public class Compatibility {
|
|||
String msg,
|
||||
Bitmap contactIcon,
|
||||
PendingIntent intent) {
|
||||
if (Version.sdkAboveOrEqual(28)) {
|
||||
if (Version.sdkAboveOrEqual(Version.API28_PIE_90)) {
|
||||
return ApiTwentyEightPlus.createMessageNotification(
|
||||
context, notif, contactIcon, intent);
|
||||
} else if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
|
||||
|
@ -151,13 +151,14 @@ public class Compatibility {
|
|||
int iconLevel,
|
||||
Bitmap largeIcon,
|
||||
PendingIntent intent,
|
||||
int priority) {
|
||||
int priority,
|
||||
boolean ongoing) {
|
||||
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
|
||||
return ApiTwentySixPlus.createNotification(
|
||||
context, title, message, icon, iconLevel, largeIcon, intent, priority);
|
||||
context, title, message, icon, iconLevel, largeIcon, intent, priority, ongoing);
|
||||
}
|
||||
return ApiTwentyOnePlus.createNotification(
|
||||
context, title, message, icon, iconLevel, largeIcon, intent, priority);
|
||||
context, title, message, icon, iconLevel, largeIcon, intent, priority, ongoing);
|
||||
}
|
||||
|
||||
public static boolean canDrawOverlays(Context context) {
|
||||
|
|
|
@ -111,7 +111,8 @@ public class NotificationsManager {
|
|||
R.mipmap.ic_launcher,
|
||||
bm,
|
||||
pendingIntent,
|
||||
Notification.PRIORITY_MIN);
|
||||
Notification.PRIORITY_MIN,
|
||||
true);
|
||||
|
||||
if (isServiceNotificationDisplayed()) {
|
||||
startForeground();
|
||||
|
|
Loading…
Reference in a new issue