|
|
@@ -40,6 +40,7 @@ import android.content.Context;
|
|
|
import android.content.SharedPreferences;
|
|
|
import android.content.SharedPreferences.Editor;
|
|
|
import android.os.Build;
|
|
|
+import android.util.Log;
|
|
|
import android.annotation.TargetApi;
|
|
|
|
|
|
import de.appplant.cordova.plugin.notification.*;
|
|
|
@@ -233,6 +234,10 @@ public class LocalNotification extends CordovaPlugin {
|
|
|
private void add(JSONArray args){
|
|
|
JSONArray notifications = args.optJSONArray(0);
|
|
|
JSONObject arguments;
|
|
|
+ if (notifications == null){
|
|
|
+ Log.e("LocalNotification-Add", "The given arguments does not contain a JSONArray");
|
|
|
+ return;
|
|
|
+ }
|
|
|
for(int i=0;i<notifications.length();i++){
|
|
|
arguments = notifications.optJSONObject(i);
|
|
|
LOG.d("LocalNotification", arguments.toString());
|
|
|
@@ -251,6 +256,10 @@ public class LocalNotification extends CordovaPlugin {
|
|
|
*/
|
|
|
private void update(JSONArray args){
|
|
|
JSONArray updates = args.optJSONArray(0);
|
|
|
+ if (updates == null){
|
|
|
+ Log.e("LocalNotification-Update", "The given arguments does not contain a JSONArray");
|
|
|
+ return;
|
|
|
+ }
|
|
|
JSONObject updateContent;
|
|
|
for(int i=0;i<updates.length();i++){
|
|
|
updateContent = args.optJSONObject(i);
|
|
|
@@ -266,6 +275,10 @@ public class LocalNotification extends CordovaPlugin {
|
|
|
private void cancel(JSONArray args){
|
|
|
JSONArray ids = args.optJSONArray(0);
|
|
|
String id;
|
|
|
+ if (ids == null){
|
|
|
+ Log.e("LocalNotification-Cancel", "The given arguments does not contain a JSONArray");
|
|
|
+ return;
|
|
|
+ }
|
|
|
for(int i=0;i<ids.length();i++){
|
|
|
id = args.optString(i);
|
|
|
nWrapper.cancel(id);
|
|
|
@@ -299,6 +312,10 @@ public class LocalNotification extends CordovaPlugin {
|
|
|
public void clear(JSONArray args){
|
|
|
JSONArray ids = args.optJSONArray(0);
|
|
|
String id;
|
|
|
+ if (ids == null){
|
|
|
+ Log.e("LocalNotification-Clear", "The given arguments does not contain a JSONArray");
|
|
|
+ return;
|
|
|
+ }
|
|
|
for(int i=0;i<ids.length();i++){
|
|
|
id = args.optString(i);
|
|
|
nWrapper.clear(id);
|