From 9f28dd45f2d353dd7437616e189a262fdad44214 Mon Sep 17 00:00:00 2001 From: Luca Caprini Date: Sat, 28 Jan 2017 15:45:07 +0100 Subject: [PATCH 1/4] addOverlay on every launch Launch addOverlay() every time app starts and not only the first time --- android/KioskActivity.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/android/KioskActivity.java b/android/KioskActivity.java index e0d3520..4e76c9b 100644 --- a/android/KioskActivity.java +++ b/android/KioskActivity.java @@ -39,7 +39,9 @@ protected void onStart() { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext()); if(Build.VERSION.SDK_INT >= 23) { sp.edit().putBoolean(PREF_KIOSK_MODE, false).commit(); - checkDrawOverlayPermission(); + if(checkDrawOverlayPermission()){ + addOverlay(); + } } else { sp.edit().putBoolean(PREF_KIOSK_MODE, true).commit(); addOverlay(); @@ -48,11 +50,15 @@ protected void onStart() { } //http://stackoverflow.com/questions/7569937/unable-to-add-window-android-view-viewrootw44da9bc0-permission-denied-for-t @TargetApi(Build.VERSION_CODES.M) - public void checkDrawOverlayPermission() { + public boolean checkDrawOverlayPermission() { if (!Settings.canDrawOverlays(this.getApplicationContext())) { Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getPackageName())); startActivityForResult(intent, REQUEST_CODE); + return false; + } + else{ + return true; } } From e294ffb5aab445eb13223ca73eb54590f72553bb Mon Sep 17 00:00:00 2001 From: Luca Caprini Date: Sat, 28 Jan 2017 15:59:33 +0100 Subject: [PATCH 2/4] KIOSK_LABEL Variable Added the KIOSK_LABEL variable in plugin installation. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a00b2e9..fc0295c 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,9 @@ By adding this Cordova plugin the Cordova app becomes the the homescreen (also k To add plugin into existing Cordova / Phonegap application: - cordova plugin add https://github.com/honza889/cordova-plugin-kiosk.git + cordova plugin add https://github.com/honza889/cordova-plugin-kiosk.git --variable KIOSK_LABEL='My Kiosk Laucher Label' + +If no `KIOSK_LABEL` value is defined, the default `Cordova Kiosk Mode` is used. The `AndroidManifest.xml` should be updated immediately. If not, you can force it by removing and re-adding Android platform: From 5d68ca906cb70d8584f33660fd9c69d73a931d04 Mon Sep 17 00:00:00 2001 From: Luca Caprini Date: Sat, 28 Jan 2017 16:00:33 +0100 Subject: [PATCH 3/4] KIOSK_LABEL Variable Added the KIOSK_LABEL variable in plugin installation. --- plugin.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 65eadb3..6c75bfd 100644 --- a/plugin.xml +++ b/plugin.xml @@ -28,6 +28,8 @@ + + @@ -56,7 +58,7 @@ - + From 5ece939b86d250dd09f7953a4f5f2e7dd5547c08 Mon Sep 17 00:00:00 2001 From: Luca Caprini Date: Thu, 2 Feb 2017 18:16:47 +0100 Subject: [PATCH 4/4] Update plugin.xml --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 6c75bfd..f36dd26 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,6 +1,6 @@ + id="cordova-plugin-kiosk" version="0.2.0"> Cordova Kiosk Mode Jan Kalina