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
I have used this method from example code.
Future _showSoundUriNotification()
Here is my code static const MethodChannel platform = MethodChannel('your channel name'); Future<void> showNotificationWithAlarmSound() async { /// this calls a method over a platform channel implemented within the /// example app to return the Uri for the default alarm sound and uses /// as the notification sound var iOSPlatformChannelSpecifics = new IOSNotificationDetails(); final String alarmUri = await platform.invokeMethod('getAlarmUri'); final UriAndroidNotificationSound uriSound = //UriAndroidNotificationSound(AndroidSounds.alarm.toString()); UriAndroidNotificationSound(alarmUri); final AndroidNotificationDetails androidPlatformChannelSpecifics = AndroidNotificationDetails( 'uri channel id', 'your channel name', 'your channel description', sound: uriSound, styleInformation: const DefaultStyleInformation(true, true)); final NotificationDetails platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics,iOSPlatformChannelSpecifics); await flutterLocalNotificationsPlugin.show( 0, 'uri sound title', 'uri sound body', platformChannelSpecifics); }
While I am running the code I am getting this error
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method getAlarmUri on channel your channel name)
As mentioned in the comments for the example app itself, you can't just copy the Dart code and expect it to work. The code related await platform.invokeMethod('getAlarmUri') makes use of platform channels and is specific to the app itself. It isn't code that is implemented by the plugin. I explicitly mention this in the comments as well
/// this calls a method over a platform channel implemented within the
/// example app to return the Uri for the default alarm sound and uses
/// as the notification sound
This is a gap in your app that you will need to address and not an issue with the plugin so will be closing. Please take care to look at the comments and code involved more closely in the future and read about platform channels
I have used this method from example code.
Future _showSoundUriNotification()
Here is my code
static const MethodChannel platform = MethodChannel('your channel name'); Future<void> showNotificationWithAlarmSound() async { /// this calls a method over a platform channel implemented within the /// example app to return the Uri for the default alarm sound and uses /// as the notification sound var iOSPlatformChannelSpecifics = new IOSNotificationDetails(); final String alarmUri = await platform.invokeMethod('getAlarmUri'); final UriAndroidNotificationSound uriSound = //UriAndroidNotificationSound(AndroidSounds.alarm.toString()); UriAndroidNotificationSound(alarmUri); final AndroidNotificationDetails androidPlatformChannelSpecifics = AndroidNotificationDetails( 'uri channel id', 'your channel name', 'your channel description', sound: uriSound, styleInformation: const DefaultStyleInformation(true, true)); final NotificationDetails platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics,iOSPlatformChannelSpecifics); await flutterLocalNotificationsPlugin.show( 0, 'uri sound title', 'uri sound body', platformChannelSpecifics); }
While I am running the code I am getting this error
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method getAlarmUri on channel your channel name)
Here is full trace
I have used other notification methods that worked fine for me.
The text was updated successfully, but these errors were encountered: