From b6dc3aa00d33e9e1f45cf1911928e81607d7ebb6 Mon Sep 17 00:00:00 2001 From: Biswas Khayargoli Date: Tue, 24 Dec 2019 16:46:00 +0545 Subject: [PATCH 1/2] Added params to change text of android location access shown during startup. --- plugin.xml | 18 +++++++++++++++++- src/android/LocationManager.java | 15 +++++++++++++-- src/android/location_access_string.xml | 3 +++ 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 src/android/location_access_string.xml diff --git a/plugin.xml b/plugin.xml index 92bbf0f..751dbac 100644 --- a/plugin.xml +++ b/plugin.xml @@ -84,8 +84,11 @@ - + + + + @@ -103,6 +106,19 @@ + + + + + $LOCATION_ACCESS_TITLE + $LOCATION_ACCESS_DESCRIPTION + + + + $LOCATION_ACCESS_TITLE + $LOCATION_ACCESS_DESCRIPTION + + diff --git a/src/android/LocationManager.java b/src/android/LocationManager.java index 0d3c97f..e64b0a7 100644 --- a/src/android/LocationManager.java +++ b/src/android/LocationManager.java @@ -317,8 +317,19 @@ private void tryToRequestMarshmallowLocationPermission() { } final AlertDialog.Builder builder = new AlertDialog.Builder(activity); - builder.setTitle("This app needs location access"); - builder.setMessage("Please grant location access so this app can detect beacons."); + String title = cordova.getActivity().getString(cordova.getActivity().getResources().getIdentifier( "location_access_title", "string", cordova.getActivity().getPackageName())); + String message = cordova.getActivity().getString(cordova.getActivity().getResources().getIdentifier( "location_access_description", "string", cordova.getActivity().getPackageName())); + + if (title == null || title.isEmpty()) { + title = "This app needs location access"; //default string for title + } + + if (message == null || message.isEmpty()) { + message = "Please grant location access so this app can detect beacons."; //default string for message + } + + builder.setTitle(title); + builder.setMessage(message); builder.setPositiveButton(android.R.string.ok, null); builder.setOnDismissListener(new DialogInterface.OnDismissListener() { @SuppressLint("NewApi") diff --git a/src/android/location_access_string.xml b/src/android/location_access_string.xml new file mode 100644 index 0000000..9c5ad89 --- /dev/null +++ b/src/android/location_access_string.xml @@ -0,0 +1,3 @@ + + + From 45edd8e137af07087427478ad5af3b339541ba03 Mon Sep 17 00:00:00 2001 From: Biswas Khayargoli Date: Fri, 27 Dec 2019 09:53:52 +0545 Subject: [PATCH 2/2] Change text from params --- src/android/LocationManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/android/LocationManager.java b/src/android/LocationManager.java index e64b0a7..df4fb8b 100644 --- a/src/android/LocationManager.java +++ b/src/android/LocationManager.java @@ -321,11 +321,11 @@ private void tryToRequestMarshmallowLocationPermission() { String message = cordova.getActivity().getString(cordova.getActivity().getResources().getIdentifier( "location_access_description", "string", cordova.getActivity().getPackageName())); if (title == null || title.isEmpty()) { - title = "This app needs location access"; //default string for title + title = "This app needs location access"; //default title } if (message == null || message.isEmpty()) { - message = "Please grant location access so this app can detect beacons."; //default string for message + message = "Please grant location access so this app can detect beacons."; //default message } builder.setTitle(title);