From ba991cb71084e137a51114e8d4781759b78c004a Mon Sep 17 00:00:00 2001 From: Martin Minchev Date: Wed, 23 Nov 2022 22:08:15 +0200 Subject: [PATCH 1/3] Add permission for sending notifications As required for Android T+ --- packages/core/src/lib/features/FeatureManager.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/core/src/lib/features/FeatureManager.ts b/packages/core/src/lib/features/FeatureManager.ts index a369d23c..20656d32 100644 --- a/packages/core/src/lib/features/FeatureManager.ts +++ b/packages/core/src/lib/features/FeatureManager.ts @@ -97,6 +97,11 @@ export class FeatureManager { if (twaManifest.features.arCore?.enabled) { this.addFeature(new ArCoreFeature()); } + + // Android T+ needs permission to request sending notifications. + if (twaManifest.enableNotifications) { + this.androidManifest.permissions.add('android.permission.POST_NOTIFICATIONS'); + } } private addFeature(feature: Feature): void { From cf1e9f9af6c9c3aeeaa9abbeb215ab70c48d507c Mon Sep 17 00:00:00 2001 From: Martin Minchev Date: Wed, 23 Nov 2022 22:11:27 +0200 Subject: [PATCH 2/3] Add the activity for requesting notification permission on Android T+ --- .../core/template_project/app/src/main/AndroidManifest.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/core/template_project/app/src/main/AndroidManifest.xml b/packages/core/template_project/app/src/main/AndroidManifest.xml index 7e8ec990..eea71658 100644 --- a/packages/core/template_project/app/src/main/AndroidManifest.xml +++ b/packages/core/template_project/app/src/main/AndroidManifest.xml @@ -232,6 +232,10 @@ + + <% if (enableNotifications) { %> + + <% } %> <% for(const component of androidManifest.components) { %> <%= component %> From 51ab87c6eb8bb20c7475196bc40493d9f92fbd4a Mon Sep 17 00:00:00 2001 From: Martin Minchev Date: Fri, 9 Dec 2022 21:30:13 +0200 Subject: [PATCH 3/3] Remove trailing spaces --- packages/core/src/lib/features/FeatureManager.ts | 2 +- packages/core/template_project/app/src/main/AndroidManifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/lib/features/FeatureManager.ts b/packages/core/src/lib/features/FeatureManager.ts index 20656d32..7913a2ea 100644 --- a/packages/core/src/lib/features/FeatureManager.ts +++ b/packages/core/src/lib/features/FeatureManager.ts @@ -97,7 +97,7 @@ export class FeatureManager { if (twaManifest.features.arCore?.enabled) { this.addFeature(new ArCoreFeature()); } - + // Android T+ needs permission to request sending notifications. if (twaManifest.enableNotifications) { this.androidManifest.permissions.add('android.permission.POST_NOTIFICATIONS'); diff --git a/packages/core/template_project/app/src/main/AndroidManifest.xml b/packages/core/template_project/app/src/main/AndroidManifest.xml index eea71658..dcb8c8dc 100644 --- a/packages/core/template_project/app/src/main/AndroidManifest.xml +++ b/packages/core/template_project/app/src/main/AndroidManifest.xml @@ -232,7 +232,7 @@ - + <% if (enableNotifications) { %> <% } %>