You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: flutter_local_notifications/README.md
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,6 +99,7 @@ Note: the plugin requires Flutter SDK 3.22 at a minimum. The list of support pla
99
99
*[Android] Retrieve the list of active notifications
100
100
*[Android] Full-screen intent notifications
101
101
*[Android] Start a foreground service
102
+
*[Android] Android Auto notification support (requires CarAppService integration—see Android setup section)
102
103
*[Android] Ability to check if notifications are enabled
103
104
*[iOS (all supported versions) & macOS 10.14+] Request notification permissions and customise the permissions being requested around displaying notifications
104
105
*[iOS 10 or newer and macOS 10.14 or newer] Display notifications with attachments
@@ -351,6 +352,52 @@ android {
351
352
352
353
</details>
353
354
355
+
#### 🚗 Supporting Android Auto Notifications
356
+
357
+
The plugin supports delivering notifications to Android Auto displays via the `showOnAndroidAuto` option. If you intend to use this feature, there is additional setup required within your Android application.
358
+
359
+
**CarAppService Implementation**
360
+
If your app supports Android Auto, your app must already define a class inheriting from [`androidx.car.app.CarAppService`](https://developer.android.com/reference/androidx/car/app/CarAppService).
361
+
362
+
**What you need to do:**
363
+
364
+
-**Let the `flutter_local_notifications` know about your service:**
365
+
`flutter_local_notifications` cannot provide this class itself, it must be supplied by you. To let the plugin access your `CarAppService`, make your `MainActivity` implement the `CarAppServiceClassConsumer` interface and return your service’s class from the required method.
returnMyCarAppService::class.java // Replace with your actual CarAppService class
382
+
}
383
+
}
384
+
```
385
+
386
+
-**When is this required?**
387
+
Only when enabling Android Auto support for notifications via the `showOnAndroidAuto` option. For standard notifications, no action is required.
388
+
389
+
-**How does this work?**
390
+
When creating a notification for Android Auto, the `flutter_local_notifications` will:
391
+
- Check if your activity implements `CarAppServiceClassConsumer`.
392
+
- If so, call `getCarAppServiceClass()` to get your service class.
393
+
- Build an intent that targets this class so notifications can be properly handled by Android Auto via `CarAppExtender` and `CarPendingIntent`.
394
+
395
+
For more details, see the [CarAppServiceClassConsumer interface](android/src/main/java/com/dexterous/flutterlocalnotifications/interfaces/CarAppServiceClassConsumer.java).
396
+
397
+
_Tip: If you do not require Android Auto support, you do not need to implement this interface._
398
+
399
+
_Tip: Before adding Android Auto notifications to your app you should review the [Car App Quality](https://developer.android.com/docs/quality-guidelines/car-app-quality) guidelines for your [App Category](https://developer.android.com/training/cars#supported-app-categories)._
400
+
354
401
### AndroidManifest.xml setup
355
402
356
403
Previously the plugin would specify all the permissions required all of the features that the plugin support in its own `AndroidManifest.xml` file so that developers wouldn't need to do this in their own app's `AndroidManifest.xml` file. Since version 16 onwards, the plugin will now only specify the bare minimum and these [`POST_NOTIFICATIONS`](https://developer.android.com/reference/android/Manifest.permission#POST_NOTIFICATIONS) and [`VIBRATE`](https://developer.android.com/reference/android/Manifest.permission#VIBRATE) permissions.
0 commit comments