mirror of
https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background
synced 2024-11-22 15:24:54 +00:00
Allow the user to set a "large icon"
Need to actually test this.
This commit is contained in:
parent
8d2ae55da6
commit
8f26b4299c
@ -27,6 +27,7 @@ import android.app.*;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Icon;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -189,6 +190,7 @@ public class ForegroundService extends Service {
|
|||||||
String text = settings.optString("text", NOTIFICATION_TEXT);
|
String text = settings.optString("text", NOTIFICATION_TEXT);
|
||||||
boolean bigText = settings.optBoolean("bigText", false);
|
boolean bigText = settings.optBoolean("bigText", false);
|
||||||
String subText = settings.optString("subText", "");
|
String subText = settings.optString("subText", "");
|
||||||
|
String largeIcon = settings.optString("largeIcon", null);
|
||||||
|
|
||||||
Context context = getApplicationContext();
|
Context context = getApplicationContext();
|
||||||
String pkgName = context.getPackageName();
|
String pkgName = context.getPackageName();
|
||||||
@ -206,6 +208,10 @@ public class ForegroundService extends Service {
|
|||||||
notification.setSubText(subText);
|
notification.setSubText(subText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (largeIcon != null) {
|
||||||
|
notification.setLargeIcon(BitmapFactory.decodeResource(getResources(), getIconResId(largeIcon)));
|
||||||
|
}
|
||||||
|
|
||||||
if (settings.optBoolean("allowClose", false)) {
|
if (settings.optBoolean("allowClose", false)) {
|
||||||
|
|
||||||
final Intent clostAppIntent = new Intent("com.backgroundmode.close" + pkgName);
|
final Intent clostAppIntent = new Intent("com.backgroundmode.close" + pkgName);
|
||||||
|
@ -419,6 +419,7 @@ exports._defaults = {
|
|||||||
hidden: true,
|
hidden: true,
|
||||||
color: undefined,
|
color: undefined,
|
||||||
icon: 'icon',
|
icon: 'icon',
|
||||||
|
largeIcon: undefined,
|
||||||
channelName: 'cordova-plugin-background-mode',
|
channelName: 'cordova-plugin-background-mode',
|
||||||
channelDescription: 'cordova-plugin-background-moden notification',
|
channelDescription: 'cordova-plugin-background-moden notification',
|
||||||
allowClose: false,
|
allowClose: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user