File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
samples/user-interface/live-updates/src/main
java/com/example/platform/ui/live_updates Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 16
16
-->
17
17
18
18
<manifest xmlns : android =" http://schemas.android.com/apk/res/android" >
19
-
19
+ <!-- Permission for posting notifications -->
20
20
<uses-permission android : name =" android.permission.POST_NOTIFICATIONS" />
21
-
21
+ <!-- Permission for live update eligibility-->
22
+ <uses-permission android : name =" POST_PROMOTED_NOTIFICATIONS" />
22
23
</manifest >
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import android.app.NotificationManager.IMPORTANCE_DEFAULT
24
24
import android.content.Context
25
25
import android.graphics.Color
26
26
import android.os.Build
27
+ import android.os.Bundle
27
28
import android.os.Handler
28
29
import android.os.Looper
29
30
import androidx.annotation.RequiresApi
@@ -188,10 +189,13 @@ object SnackbarNotificationManager {
188
189
189
190
@RequiresApi(Build .VERSION_CODES .O )
190
191
fun buildBaseNotification (appContext : Context , orderState : OrderState ): Notification .Builder {
191
- var notificationBuilder = Notification .Builder (appContext, CHANNEL_ID )
192
+ val promotedExtras = Bundle ()
193
+ promotedExtras.putBoolean(" android.requestPromotedOngoing" , true )
194
+ val notificationBuilder = Notification .Builder (appContext, CHANNEL_ID )
192
195
.setSmallIcon(R .drawable.ic_launcher_foreground)
193
196
.setOngoing(true )
194
197
.setColorized(true )
198
+ .addExtras(promotedExtras)
195
199
196
200
when (orderState) {
197
201
INITIALIZING -> {}
You can’t perform that action at this time.
0 commit comments