Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Android Auto notification support #4078

Merged
merged 1 commit into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/240.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Android Auto notification support
4 changes: 4 additions & 0 deletions vector/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
android:name="android.max_aspect"
android:value="9.9" />

<meta-data
android:name="com.google.android.gms.car.application"
android:resource="@xml/automotive_app_desc" />

<activity
android:name=".features.MainActivity"
android:theme="@style/Theme.Vector.Launcher" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,10 +597,12 @@ class NotificationUtils @Inject constructor(private val context: Context,
val markRoomReadPendingIntent = PendingIntent.getBroadcast(context, System.currentTimeMillis().toInt(), markRoomReadIntent,
PendingIntent.FLAG_UPDATE_CURRENT)

addAction(NotificationCompat.Action(
R.drawable.ic_material_done_all_white,
stringProvider.getString(R.string.action_mark_room_read),
markRoomReadPendingIntent))
NotificationCompat.Action.Builder(R.drawable.ic_material_done_all_white,
stringProvider.getString(R.string.action_mark_room_read), markRoomReadPendingIntent)
.setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_MARK_AS_READ)
.setShowsUserInterface(false)
.build()
.let { addAction(it) }

// Quick reply
if (!roomInfo.hasSmartReplyError) {
Expand All @@ -611,6 +613,8 @@ class NotificationUtils @Inject constructor(private val context: Context,
NotificationCompat.Action.Builder(R.drawable.vector_notification_quick_reply,
stringProvider.getString(R.string.action_quick_reply), replyPendingIntent)
.addRemoteInput(remoteInput)
.setSemanticAction(NotificationCompat.Action.SEMANTIC_ACTION_REPLY)
.setShowsUserInterface(false)
.build()
.let { addAction(it) }
}
Expand Down
4 changes: 4 additions & 0 deletions vector/src/main/res/xml/automotive_app_desc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<automotiveApp>
<uses name="notification" />
</automotiveApp>