Please provide the following:
- SDK Version: “34.0.0”
- Platforms(ios/android/both): android
I am having problems getting the android notification channels to make a sound. I have added the proper logic in the php sdk ExponentPhpSDK\Expo
// Build the notification data
$notification = [
'title' => $this->subject,
'body' => $this->body,
'badge' => 1,
'channelId' => 'notification-sound-channel',
'data' => json_encode([
'messageType' => $this->subject,
'message' => $this->body,
])
];
This is the call for JavaScript which is called from componentDidMount
registerForPushNotificationsAsync = async () => {
const { status: existingStatus } = await Permissions.getAsync(Permissions.NOTIFICATIONS);
let finalStatus = existingStatus;
// only ask if permissions have not already been determined, because
// iOS won't necessarily prompt the user a second time.
if (existingStatus !== 'granted') {
// Android remote notification permissions are granted during the app
// install, so this will only ask on iOS
const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
finalStatus = status;
}
// Stop here if the user did not grant permissions
if (finalStatus !== 'granted') {
return;
}
// Get the token that uniquely identifies this device
const token = await Notifications.getExpoPushTokenAsync();
const { user } = this.props.auth;
if (Platform.OS === 'android') {
Notifications.createChannelAndroidAsync('notification-sound-channel', {
name: 'Notification Sound Channel',
sound: true,
priority: 'max',
vibrate: [0, 250, 250, 250],
});
}
this.props.saveExpoNotificationsToken(user.user_id, token);
};
You can also see here when I hard press on the notification it shows my channel I created Notification Sound Channel
and it is on
and also in the settings for notifications it shows as on and it shows its a
sound
setting
Do these notifications not work when being used with expo but will work on a real device when the app goes through the play store and is released? is it a user setting I am not checking? I am an iOS user so I am not sure if its me “the user” not turning on the right setting but I seem to have done everything I needed to do and it is just not working. I have also seeing SOME of these similar posts around but they all get closed and NO ONE answers, can someone please respond! lol
Oh, also, why doesn’t android “pop up” the notification like on iOS? is this an android thing, a Samsung android thing? etc I am testing this on a Samsung Galaxy s9