From f363b2717f3122077996291fdf4f6afb23c2fa8d Mon Sep 17 00:00:00 2001 From: Ian Date: Tue, 22 Oct 2024 11:40:06 -0700 Subject: [PATCH] android service update --- .../src/main/AndroidManifest.xml | 1 + .../picovoicedemoservice/MainActivity.java | 38 +++++++++++++++---- .../drawable-v24/ic_launcher_background.xml | 10 +++++ .../drawable-v24/ic_launcher_foreground.xml | 37 +++++++----------- .../src/main/res/values/strings.xml | 3 +- 5 files changed, 55 insertions(+), 34 deletions(-) create mode 100644 demo/android/Service/picovoice-service-demo-app/src/main/res/drawable-v24/ic_launcher_background.xml diff --git a/demo/android/Service/picovoice-service-demo-app/src/main/AndroidManifest.xml b/demo/android/Service/picovoice-service-demo-app/src/main/AndroidManifest.xml index 098df7beb..a3c3b04d4 100644 --- a/demo/android/Service/picovoice-service-demo-app/src/main/AndroidManifest.xml +++ b/demo/android/Service/picovoice-service-demo-app/src/main/AndroidManifest.xml @@ -4,6 +4,7 @@ + { if (recordButton.isChecked()) { - if (hasRecordPermission()) { + ArrayList permissionsToRequest = new ArrayList<>(); + if (!hasNotificationPermission()) { + permissionsToRequest.add(Manifest.permission.POST_NOTIFICATIONS); + } + if (!hasRecordPermission()) { + permissionsToRequest.add(Manifest.permission.RECORD_AUDIO); + } + + if (permissionsToRequest.size() == 0) { startService(); } else { - requestRecordPermission(); + requestRecordPermissions(permissionsToRequest.toArray(new String[0])); } } else { stopService(); diff --git a/demo/android/Service/picovoice-service-demo-app/src/main/res/drawable-v24/ic_launcher_background.xml b/demo/android/Service/picovoice-service-demo-app/src/main/res/drawable-v24/ic_launcher_background.xml new file mode 100644 index 000000000..196e181ea --- /dev/null +++ b/demo/android/Service/picovoice-service-demo-app/src/main/res/drawable-v24/ic_launcher_background.xml @@ -0,0 +1,10 @@ + + + + diff --git a/demo/android/Service/picovoice-service-demo-app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/demo/android/Service/picovoice-service-demo-app/src/main/res/drawable-v24/ic_launcher_foreground.xml index 2b068d114..d2923ae6a 100644 --- a/demo/android/Service/picovoice-service-demo-app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ b/demo/android/Service/picovoice-service-demo-app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -1,30 +1,19 @@ - - - - - - - - + - \ No newline at end of file + android:pathData="M229.001,229.001m-225,0a225,225 0,1 1,450 0a225,225 0,1 1,-450 0" + android:strokeWidth="4.73" + android:fillColor="#377DFF" + android:strokeColor="#377DFF"/> + + + diff --git a/demo/android/Service/picovoice-service-demo-app/src/main/res/values/strings.xml b/demo/android/Service/picovoice-service-demo-app/src/main/res/values/strings.xml index f0c2d7753..00f0a0ca7 100644 --- a/demo/android/Service/picovoice-service-demo-app/src/main/res/values/strings.xml +++ b/demo/android/Service/picovoice-service-demo-app/src/main/res/values/strings.xml @@ -5,6 +5,5 @@ Context: Smart Lighting Example Phrase: - \"Hey Porcupine, make the living room lights purple.\" - Show Context + \"Porcupine, turn off the living room lights.\" \ No newline at end of file