mirror of
https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background
synced 2024-12-23 13:57:35 +00:00
Dont crash if color has wrong format
This commit is contained in:
parent
337e39b2db
commit
8b434e041c
@ -87,8 +87,7 @@ public class BackgroundMode extends CordovaPlugin {
|
||||
* @param callback The callback context used when
|
||||
* calling back into JavaScript.
|
||||
*
|
||||
* @return
|
||||
* Returning false results in a "MethodNotFound" error.
|
||||
* @return Returning false results in a "MethodNotFound" error.
|
||||
*
|
||||
* @throws JSONException
|
||||
*/
|
||||
@ -131,8 +130,7 @@ public class BackgroundMode extends CordovaPlugin {
|
||||
/**
|
||||
* Called when the system is about to start resuming a previous activity.
|
||||
*
|
||||
* @param multitasking
|
||||
* Flag indicating if multitasking is turned on for app
|
||||
* @param multitasking Flag indicating if multitasking is turned on for app.
|
||||
*/
|
||||
@Override
|
||||
public void onPause(boolean multitasking) {
|
||||
@ -144,8 +142,7 @@ public class BackgroundMode extends CordovaPlugin {
|
||||
/**
|
||||
* Called when the activity will start interacting with the user.
|
||||
*
|
||||
* @param multitasking
|
||||
* Flag indicating if multitasking is turned on for app
|
||||
* @param multitasking Flag indicating if multitasking is turned on for app.
|
||||
*/
|
||||
@Override
|
||||
public void onResume(boolean multitasking) {
|
||||
|
@ -35,7 +35,6 @@ import android.os.PowerManager;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
@ -251,18 +250,13 @@ public class ForegroundService extends Service {
|
||||
if (Build.VERSION.SDK_INT < 21 || hex == null)
|
||||
return;
|
||||
|
||||
int aRGB = Integer.parseInt(hex, 16) + 0xFF000000;
|
||||
|
||||
try {
|
||||
int aRGB = Integer.parseInt(hex, 16) + 0xFF000000;
|
||||
Method setColorMethod = notification.getClass().getMethod(
|
||||
"setColor", int.class);
|
||||
|
||||
setColorMethod.invoke(notification, aRGB);
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user