Commit e3842e41 by Sebastián Katzer

App does not crash/stop anymore after removing them from recent list.

parent 94a80117
......@@ -12,10 +12,10 @@ package de.appplant.cordova.plugin.localnotification;
import java.util.Calendar;
import java.util.Date;
import org.apache.cordova.CordovaInterface;
import org.json.JSONObject;
import android.app.AlarmManager;
import android.content.Context;
import android.media.RingtoneManager;
import android.net.Uri;
......@@ -29,6 +29,7 @@ public class LocalNotificationOptions {
*/
private JSONObject options = new JSONObject();
private String id = null;
private String packageName = null;
private long interval = 0;
private long date = 0;
......@@ -36,6 +37,24 @@ public class LocalNotificationOptions {
* Parse options passed from javascript part of this plugin.
*/
LocalNotificationOptions (JSONObject options) {
packageName = LocalNotification.cordova.getActivity().getPackageName();
parse(options);
}
/**
* Parse options passed from javascript part of this plugin.
*/
LocalNotificationOptions (JSONObject options, Context context) {
packageName = context.getPackageName();
parse(options);
}
/**
* Parst die übergebenen Eigenschaften.
*/
private void parse (JSONObject options) {
String repeat = options.optString("repeat");
this.options = options;
......@@ -116,8 +135,6 @@ public class LocalNotificationOptions {
*/
public int getIcon () {
int icon = 0;
CordovaInterface cordova = LocalNotification.cordova;
String packageName = cordova.getActivity().getPackageName();
String iconName = options.optString("icon", "icon");
icon = getIconValue(packageName, iconName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment