Bug Report
Plugin
@capacitor/local-notifications
Capacitor Version
@capacitor/core: 7.x
@capacitor/local-notifications: 7.x
Platform
Android (specifically Xiaomi/MIUI/HyperOS devices)
Current Behavior
The LocalNotificationsPlugin.java hardcodes NotificationCompat.PRIORITY_DEFAULT when building notifications:
NotificationCompat.Builder builder = new NotificationCompat.Builder(getContext(), notification.getChannelId())
.setSmallIcon(smallIcon)
.setContentTitle(notification.getTitle())
.setContentText(notification.getBody())
.setPriority(NotificationCompat.PRIORITY_DEFAULT) // hardcoded
On Xiaomi/MIUI/HyperOS devices (Android 11+), PRIORITY_DEFAULT notifications:
- Do NOT show as heads-up (popup) notifications
- Silently appear in the status bar only
- User has no way to see the notification without pulling down the shade
Expected Behavior
Notifications should appear as heads-up popups when:
- The channel importance is set to IMPORTANCE_HIGH
- The notification priority is PRIORITY_HIGH or PRIORITY_MAX
The plugin should either:
- Respect the channel importance level and set priority accordingly
- Expose a priority option in the NotificationSchema interface
- Default to PRIORITY_HIGH when channel importance is HIGH
Steps to Reproduce
- Create a notification channel with importance: 4 (HIGH)
- Schedule a notification using LocalNotifications.schedule()
- On a Xiaomi device, the notification appears in status bar but NOT as a popup
Workaround
Create a custom native plugin that uses PRIORITY_HIGH:
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setCategory(NotificationCompat.CATEGORY_ALARM)
.setDefaults(NotificationCompat.DEFAULT_ALL);
Additional Context
- This affects all Xiaomi/MIUI/HyperOS devices (Android 11+)
- dumpsys notification shows the notification with importance=DEFAULT even when channel is IMPORTANCE_HIGH
- Setting PRIORITY_HIGH resolves the issue immediately
Suggested Fix
In LocalNotificationsPlugin.java, change:
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
to:
.setPriority(NotificationCompat.PRIORITY_HIGH)
Or better, make it configurable via the NotificationSchema:
await LocalNotifications.schedule({
notifications: [{
title: "Test",
body: "Test notification",
priority: "high"
}]
});
Bug Report
Plugin
@capacitor/local-notifications
Capacitor Version
@capacitor/core: 7.x
@capacitor/local-notifications: 7.x
Platform
Android (specifically Xiaomi/MIUI/HyperOS devices)
Current Behavior
The LocalNotificationsPlugin.java hardcodes NotificationCompat.PRIORITY_DEFAULT when building notifications:
On Xiaomi/MIUI/HyperOS devices (Android 11+), PRIORITY_DEFAULT notifications:
Expected Behavior
Notifications should appear as heads-up popups when:
The plugin should either:
Steps to Reproduce
Workaround
Create a custom native plugin that uses PRIORITY_HIGH:
Additional Context
Suggested Fix
In LocalNotificationsPlugin.java, change:
to:
Or better, make it configurable via the NotificationSchema: