Skip to content

Commit

Permalink
Adds support for Notification Delegation
Browse files Browse the repository at this point in the history
- Adds the TrustedWebActivity service to the Android Manifest.
- Adds a variable to build.gradle to enable / disable the service.

Change-Id: I9822a1488f9aabdc61b751c246bb4cae3874a7f9
  • Loading branch information
andreban committed May 20, 2019
1 parent 3c39bd6 commit ae9bd04
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def twaManifest = [
launchUrl: '/', // The start path for the TWA. Must be relative to the domain.
name: 'SVGOMG TWA', // The name shown on the Android Launcher.
themeColor: '#303F9F', // The color used for the status bar.
backgroundColor: '#bababa' // The color used for the splash screen background.
backgroundColor: '#bababa', // The color used for the splash screen background.
enableNotifications: false // Set to true to enable notification delegation
]

android {
Expand Down Expand Up @@ -65,6 +66,11 @@ android {

// Defines a provider authority fot the Splash Screen
resValue "string", "providerAuthority", twaManifest.applicationId + '.fileprovider'

// The enableNotification resource is used to enable or disable the
// TrustedWebActivityService, by changing the android:enabled and android:exported
// attributes
resValue "bool", "enableNotification", twaManifest.enableNotifications.toString()
}
buildTypes {
release {
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,16 @@
android:resource="@xml/filepaths" />
</provider>

<service
android:name="android.support.customtabs.trusted.TrustedWebActivityService"
android:enabled="@bool/enableNotification"
android:exported="@bool/enableNotification">

<intent-filter>
<action android:name="android.support.customtabs.trusted.TRUSTED_WEB_ACTIVITY_SERVICE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</service>

</application>
</manifest>

0 comments on commit ae9bd04

Please sign in to comment.