APN ( apple push notification ) using expo cli not able to access the custom data

140 Views Asked by At

i using APN (Apple push notification ) for expo react native app, i sending push notification using php code from server, with notification i am sending custom data reacordid. , when i am try to use that use recordid, app is getting closed.

Below image is the response of APN

enter image description here

in the above image pancel marked custom data recordid want use in the app, if am using that recordid app getting closed, how to use that recordid variable in app ?

notificationListener.current = Notifications.addNotificationReceivedListener(notification => {
    setNotification(notification);
    let id = 1;
    let str= null;
    alert("notf:: values:"+JSON.stringify(notification));
    
     
    
    if (Platform.OS === 'android'){
        id = notification.request.content.data.recordid;
    }  if (Platform.OS === 'ios'){{
        // ios platform 
        let trigger:any = notification.request.trigger;
    
    //    id = notification.request.trigger.payload.recordid;//not working
        id = trigger.payload.aps.recordid; // check this
        
    }
0

There are 0 best solutions below