mirror of
https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background
synced 2024-11-15 03:54:54 +00:00
Fix wrong icon resource
This commit is contained in:
parent
a63e750487
commit
aed89d8503
@ -93,7 +93,7 @@ public class ForegroundService extends Service {
|
|||||||
* Put the service in a foreground state to prevent app from being killed
|
* Put the service in a foreground state to prevent app from being killed
|
||||||
* by the OS.
|
* by the OS.
|
||||||
*/
|
*/
|
||||||
public void keepAwake() {
|
private void keepAwake() {
|
||||||
JSONObject settings = BackgroundMode.getSettings();
|
JSONObject settings = BackgroundMode.getSettings();
|
||||||
boolean isSilent = settings.optBoolean("silent", false);
|
boolean isSilent = settings.optBoolean("silent", false);
|
||||||
|
|
||||||
@ -101,7 +101,8 @@ public class ForegroundService extends Service {
|
|||||||
startForeground(NOTIFICATION_ID, makeNotification());
|
startForeground(NOTIFICATION_ID, makeNotification());
|
||||||
}
|
}
|
||||||
|
|
||||||
PowerManager powerMgr = (PowerManager) getSystemService(POWER_SERVICE);
|
PowerManager powerMgr = (PowerManager)
|
||||||
|
getSystemService(POWER_SERVICE);
|
||||||
|
|
||||||
wakeLock = powerMgr.newWakeLock(
|
wakeLock = powerMgr.newWakeLock(
|
||||||
PowerManager.PARTIAL_WAKE_LOCK, "BackgroundMode");
|
PowerManager.PARTIAL_WAKE_LOCK, "BackgroundMode");
|
||||||
@ -174,7 +175,7 @@ public class ForegroundService extends Service {
|
|||||||
* @param settings
|
* @param settings
|
||||||
* The config settings
|
* The config settings
|
||||||
*/
|
*/
|
||||||
public void updateNotification (JSONObject settings) {
|
protected void updateNotification (JSONObject settings) {
|
||||||
boolean isSilent = settings.optBoolean("silent", false);
|
boolean isSilent = settings.optBoolean("silent", false);
|
||||||
|
|
||||||
if (isSilent) {
|
if (isSilent) {
|
||||||
@ -202,6 +203,12 @@ public class ForegroundService extends Service {
|
|||||||
String pkgName = context.getPackageName();
|
String pkgName = context.getPackageName();
|
||||||
String icon = settings.optString("icon", "icon");
|
String icon = settings.optString("icon", "icon");
|
||||||
|
|
||||||
return res.getIdentifier(icon, "drawable", pkgName);
|
int resId = res.getIdentifier(icon, "drawable", pkgName);
|
||||||
|
|
||||||
|
if (resId == 0) {
|
||||||
|
resId = res.getIdentifier("icon", "drawable", pkgName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user