Notification Listener not working in iOS ( standalone ios)

Hi
Push notification does not work.
standalone android works well
but standalone ios not work…
The push receipt says that the reception is good.
( status: ok )

Not standalone app works well ( iOS and Android ) …
But… standalone iOS app …is not work,
please help me

SDK : 32.0.0

Hi @umy! The receipt may say ‘ok’, but you should still check it. From our Push Notifications Docs:

Note: Even if a receipt says “ok”, it doesn’t guarantee that the device has received the message; “ok” in a push receipt means that the Android or iOS push notification service successfully received the notification. If the recipient device is turned off, for example, the iOS or Android push notification service will try to deliver the message but the device won’t necessarily receive it.

That should provide more info as to what’s going on :+1:

Thanks. ㅠㅠ

// Post data here.
{
“to” : “ExponentPushToken[_CVVriA_xAgMYRaiSSZYxd]”,
“badge” : 1,
“title” : “Please!!!”,
“body” : “ComeComeCome”
}

// Push Receipt data
{
“data”: {
“id”: “565e0ee9-57e7-493e-af2f-4585922ad3d2”,
“status”: “ok”
}
}

My App.js source .
// Save token
_getToken = async() => {
// Device Check
if (!Constants.isDevice) {return}

// Permission Check
let { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
if (status != ‘granted’) {return}

// Android needs push channel
if (Platform.OS === ‘android’) {
Notifications.createChannelAndroidAsync(‘newApp-android-channel’, {
name: ‘newApp-android-channel’,
sound: true,
vibrate: [0, 250, 250, 250],
priority: ‘max’,
});
}

// GET EXPO PUSH TOKEN
const token = await Notifications.getExpoPushTokenAsync();
console.log("@@ Async Uesr Token = "+token);
alert(token );

this.setState({
token
})

}

componentWillUnmount(){
this.listener && this.listener.remove();
}

componentDidMount(){

// GET EXPO PUSH TOKEN
this._getToken();

// GET PUSH DATA
this.listener = Notifications.addListener(this.handleNotification);
}

// Get push data
handleNotification = ( {origin, data} ) => {
//console.log(push notificaton ${origin} with data : ${JSON.stringify(data)});
alert(push notificaton ${origin} with data : ${JSON.stringify(data)});
};

My app.json

{
“expo”: {
“name”: “newApp”,
“slug”: “newApp”,
“privacy”: “public”,
“sdkVersion”: “32.0.0”,
“platforms”: [
“ios”,
“android”
],
“version”: “1.0.0”,
“orientation”: “portrait”,
“icon”: “./assets/sample-icon.png”,
“splash”: {
“image”: “./assets/splash.png”,
“resizeMode”: “contain”,
“backgroundColor”: “#ffffff
},
“updates”: {
“fallbackToCacheTimeout”: 0
},
“assetBundlePatterns”: [
“**/*”
],
“ios”: {
“supportsTablet”: true,
“bundleIdentifier”: “com.klic.testEdunote”
},
“android”: {
“package”: “com.klic.newEdunote”,
“googleServicesFile”: “./google-services.json”,
“permissions”:

}

}
}

Please Help me…

Hey @umy,

The code you posted is not legible as is. Can you please throw it in a snack or a github repo that can ensure it’s properly formatted and legible?

Cheers,
Adam

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.