VibrationPattern not working as expected
See original GitHub issueI am having trouble getting VibrationPattern to work. I tried using a pattern where the phone waits for a second and then vibrates for a second and have that done 3 times in a row. However, the actual vibration pattern is the default one for the phone I am testing with (Android 12), more precisely just two bursts of vibration with very little pause in between.
Here is my code:
LocalNotificationCenter.Current.Clear(_notificationId);
var notification = new NotificationRequest
{
NotificationId = _notificationId,
Title = $"{period.Name} started!",
Subtitle = scheduleName,
Description = $"Period {period.Name} just started!",
CategoryType = NotificationCategoryType.Alarm,
Android = new AndroidOptions
{
Color = new AndroidColor(period.Color.ToInt()),
VibrationPattern = new long[] { 1000, 1000, 1000, 1000, 1000, 1000 }
}
};
await LocalNotificationCenter.Current.Show(notification);
Am I doing something wrong?
Issue Analytics
- State:
- Created 8 months ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Alert - Vibration, not working? : r/tasker
My method is to remove "vibrate" and use "vibrate pattern" instead, on Tasker. It work perfectly and I replaced all my "vibrate" with...
Read more >Custom vibration pattern for notification stops working in ...
but suddenly the custom vibration stops working until I restarts app (notification pops up with only default vibration, not with my custom one)....
Read more >Vibration not working even if Silence mod…
First, I'd suggest verifying that Vibration is enabled in Settings > Accessibility > Touch > Vibration. If it's not enabled, tap to enable...
Read more >android - Notification Sound, Vibration and LED don't work
Based on your comments, it seems to be problem with your phone itself. I was asking in (1) regarding the vibration because you...
Read more >Phone Not Vibrating; Here's Why? & The Best Fixes
Phone not vibrating? Discover the reasons and best fixes for this issue: Troubleshoot software glitches, updates, and hardware problems.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@thudugala
thanks for your response.
It’s finally working now. I had to do two things:
move the creation of the channel to mauiprogram.cs: .UseLocalNotification(config => { config.AddAndroid(android => … ETC…
I had to set Silent property (of the NotificationRequest) to false. Apparently this was set to true.
After these changes the virbration works as expected! Thanks again!
@IonutArhire and @FikriIso
You can only set the vibration pattern before the channel created.
Have try uninstalling and installing the app again?