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
custom sound not working on devices but working in emulator #2287
Comments
same issue while set custom sound if you have any solution then please share |
not yet! |
For Android 8.0+, sounds and vibrations are associated with notification channels and can only be configured when they are first created. Showing/scheduling a notification will create a channel with the specified id if it doesn't exist already. If another notification specifies the same channel id but tries to specify another sound or vibration pattern then nothing occurs. refer this link https://pub.dev/packages/flutter_local_notifications#custom-notification-icons-and-sounds So if you change the custom sound, the app has to be reinstalled to get in same channel |
Besides what @ditheshthegreat has mentioned, did you check to make sure that you have done release build configuration? If not, then please double check the readme as it's quite possible you missed other steps that are relevant |
path to custom sound
android/app/src/main/res/raw/azan.wav
static Future _notificationDetails() async {
return const NotificationDetails(
android: AndroidNotificationDetails(
'Channel_id_17',
'Channel_name',
importance: Importance.high,
priority: Priority.high,
sound: RawResourceAndroidNotificationSound('azan'),
enableVibration: true,
playSound: true,
),
iOS: DarwinNotificationDetails(sound: 'azan.wav'),
);
}
static Future init({bool initSchedule = false}) async {
const AndroidInitializationSettings android =
AndroidInitializationSettings('@mipmap/ic_launcher');
}
static void showScheduleNotification({
int id = 0,
String? title,
String? body,
String? payload,
required DateTime scheduleTime,
}) async {
try {
await _notifications.zonedSchedule(
id ,
title,
body,
tz.TZDateTime.from(repeatScheduleTime, tz.local),
await _notificationDetails(),
payload: payload,
androidAllowWhileIdle: true,
uiLocalNotificationDateInterpretation:
UILocalNotificationDateInterpretation.absoluteTime,
matchDateTimeComponents: DateTimeComponents.time,
);
} catch (e) {
print('Error scheduling notification: $e');
}
}
}
these are the implementation
working in the emulator with custom sound but in real devices the custom sound is not working but the notifications are coming.
any one know please help me!
The text was updated successfully, but these errors were encountered: