From 9537dc98160cfdae6c5c931d098fa401e86d811d Mon Sep 17 00:00:00 2001 From: lampaa Date: Fri, 1 Jun 2018 10:51:02 +0300 Subject: [PATCH] add support java 1.6 --- README.md | 3 ++- package.json | 2 +- plugin.xml | 2 +- src/android/Assets.java | 12 +++++++++--- src/android/startApp.java | 40 +++++++++++++++++++-------------------- 5 files changed, 32 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index f581c19..f73f79e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ Phonegap plugin for check or launch other application, get extras in phonegap app. -Last version 6.1.5 +Last version 6.1.6 +* Add support java 1.6 * Add support java 1.7 * Add full support activityForResult, sendBroadcast and RegisterReceiver. * Add types of extras. diff --git a/package.json b/package.json index 73e3753..d73e682 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.lampa.startapp", - "version": "6.1.5", + "version": "6.1.6", "description": "Phonegap plugin for check or launch other application in android device.", "cordova": { "id": "com.lampa.startapp", diff --git a/plugin.xml b/plugin.xml index 64d734c..b36264d 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="6.1.6"> startApp Phonegap plugin for check or launch other application in android device. diff --git a/src/android/Assets.java b/src/android/Assets.java index ba63c41..685f9db 100644 --- a/src/android/Assets.java +++ b/src/android/Assets.java @@ -1,3 +1,11 @@ +/** + com.lampa.startapp, ver. 6.1.6 + https://github.com/lampaa/com.lampa.startapp + + Phonegap plugin for check or launch other application in android device (iOS support). + bug tracker: https://github.com/lampaa/com.lampa.startapp/issues +*/ + package com.lampa.startapp; import android.content.Intent; @@ -7,9 +15,7 @@ import org.apache.cordova.CordovaPlugin; import java.lang.reflect.Field; -/** - * Created by User on 16.05.2018. - */ + public class Assets extends CordovaPlugin { protected static final String TAG = "startApp"; protected boolean NO_PARSE_INTENT_VALS = false; diff --git a/src/android/startApp.java b/src/android/startApp.java index cf499c4..8807597 100644 --- a/src/android/startApp.java +++ b/src/android/startApp.java @@ -1,5 +1,5 @@ /** - com.lampa.startapp, ver. 6.1.3 + com.lampa.startapp, ver. 6.1.6 https://github.com/lampaa/com.lampa.startapp Phonegap plugin for check or launch other application in android device (iOS support). @@ -38,25 +38,23 @@ public class startApp extends Assets { * @return Always return true. */ public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { - switch (action) { - case "start": - this.start(args, callbackContext); - break; - case "check": - this.check(args, callbackContext); - break; - case "receiver": - this.receiver(args, callbackContext); - break; - case "unReceiver": - this.receiver(args, callbackContext); - break; - case "getExtras": - this.getExtras(callbackContext); - break; - case "getExtra": - this.getExtra(args, callbackContext); - break; + if(action.equals("start")) { + this.start(args, callbackContext); + } + else if(action.equals("check")) { + this.check(args, callbackContext); + } + else if(action.equals("receiver")) { + this.receiver(args, callbackContext); + } + else if(action.equals("unReceiver")) { + this.receiver(args, callbackContext); + } + else if(action.equals("getExtras")) { + this.getExtras(callbackContext); + } + else if(action.equals("getExtra")) { + this.getExtra(args, callbackContext); } return true; @@ -104,7 +102,7 @@ public class startApp extends Assets { //cordova.getActivity().getApplicationContext() - cordova.getContext().registerReceiver(receiver, filter); + cordova.getActivity().getApplicationContext().registerReceiver(receiver, filter); broadcastReceiverHashMap.put(receiver.hashCode(), receiver); PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, receiver.hashCode());