iOS push notification coming twice - ios

I am using the one signal third party sdk to send push notification, for this, i had created ssl certificate and export p12 to one signal dashboard.
For some reason my own server need to send push notification for this I have created another SSL certificate and give pem to the my server side.
Once my server send push notification, one signal also send push notification, what is issue anyone suggest me to solve this type of problem.
How to solve this type of issue.

OneSignal is designed to never deliver the same notification to the same device, so it seems like the likely cause of this issue is that you are delivering the notification twice yourself (once through your own server, and then another time through OneSignal).

Related

Is it possible to see the data of push notification from APNS on iPhone?

I am currently debugging for an existing iOS application, and I need to use the data from push notification to perform some actions. Since the backend team failed to provide me with the data model of their push notification, I have to figure it out myself.
The push is only available on TestFlight build (which means I couldn't print the push notification in my Xcode). Therefore I tried to setup a proxy using mitmproxy to intercept it. But somehow the push notification is not shown in the mitmproxy terminal.
I did some basic research and it seems to me it is impossible to intercept and see the push notification from apns on my macbook. Can someone give me a hint of where to look for and start with?

APN Push Notifications coming in bursts

I'm developing an iOS app and I'm facing this weird bug where the push notifications come in bursts.
Basically, let's say I send 10 push notifications with APN from a server (my logs show that the push notification sends), but I don't receive it until some arbitray time later, when I receive all 10 notifications at once.
I've double-checked my app-side code and have also tried re-generating/re-uploading the p12 certs and after looking around here, I haven't managed to find anything either./
Would anyone be able to shed some light on this? Any help is appreciated!
*UPDATE: my logs show that every time the server sends a push notification, it also sends a 'apple sandbox notification' simultaneously, but I'm notsure what that is

How to receive remote notifications after iPhone comes back online?

I am currently building a laravel provider service to send push notifications to IOS devices. I have followed this tutorial for creating a sample app which is able to receive notifications.
On my server side, I used this package to handle push notifications.
During testing, the app manages to receive push notifications when the device is connected to wifi/4G, during foreground/background/inactive modes. However if I send the push notification to the app when its offline, on connecting the device back to the internet I do not receive any notifications.
According to the apple documentation, the APNS service stores any notification which is sent when the device is offline and delivers it to the client after connection is re-established. It is supposed to dispose of any notifications if the device stays offline for a long time (duration not exactly specified). However I am keeping the device offline for only a minute before going online. Can anyone please suggest a solution?
Thanks to Brandon I managed to know what the problem actually was. The next challenge I faced was how to integrate the expiry period for the notification in the message payload using the davibennum/laravel-push-notification package. Since there was no documentation regarding this, I had to go through the source code to find out how to define the expiry period. Turns out the expiry time can be set simply by defining it like this in the message payload:
'expire' => Carbon::now()->addDays(30)
Basically you are passing a date time instance, which will then be transformed to the apns-expiration header of the request.

iOS Notifications are not receiving that are sent from the server

First of all may be it will be a duplicate question, but due to curiosity I have asked.
I have an application in which push notifications are used, I have prepared, created all the required things for it and at last I have checked the notifications on this link: https://pushtry.com/. All are working well. NOw the problem is that, when admin wants to send the notification from their admin panel the push notifications are not receiving in iOS device.
I have update all the necessary certificates, pem files, methods for iOS 10 etc, but I don't get received the notifictions from admin panel, as per backend, when we send notifications it shows notification send successfully and showing no error for it. I don't know whats wrong going.
Any sugesstions....
First check all the validations or verifications like certificate, pem file and other things are updated on iOS and backend side. This will ensures that nothing error or fault at both ends.
Now reinstall the app in iOS, Clear all notification ids or apns token table from database. On installing the app, you will see there are few apis token available. Now open your admin panel and test again, it will works correctly.
Firstly I want to confirm which certificate you are used for the app developer or distribution.Because there are different ways for sending the notification for both(developer or distribution). Like I am using php services at backend.When I am using developer certificate my backend developer used 'ssl://gateway.sandbox.push.apple.com:2195', $err,
and when I used distribution certificate he used
//'ssl://gateway.push.apple.com:2195', $err.
Thanks

can it possible to use chat service without apns

I am using message chat service in my application by service request and response. But problem is that when sender sending message to receiver end receiver did'nt get any notification about the send message.
Just tell me what is the best option to respond the notification to the receiver.
Can it possible without using apple push notification service.
Adding my answers below if someone comes later with the exact same question.
If app is in foreground and user is doing live chatting you can use any of the lightweight messaging protocol(like MQTT/XMPP) to notify about new message. In this case better to put message as a payload itself for instant messaging.
For reference you can check out sample code here how to do it with MQTT.
But you should debug why your notification is not working. There are few checkpoints I can see:
1) Check your device tokenId you are storing on your application server.(In case of APNS it should be of 64 char length).
2) Check if push notification is enabled for you application in apple developer member center.
3) Check your SSL certificate used by your application server is proper. here is the simple step by step guide to get SSL cert.
https://blog.applozic.com/get-your-apple-push-ssl-certificate-abebf1edb338#.v7xu5cn0k
4) Make sure your code signing cert type is matching with apple push SSL certificate.Like if you are signing your code with developer certificate, apple push ssl cert should be of development one (not distribution).
Hope this might help others.
APNS is not for CHAT Use XMPP or MQTT. for both you will require a server side implementation.
For XMPP you can use use XMPPFramework. and for MQTT you can use Mosquito.
first you have to seen the all properties of the push notification like token id is right or not. is your appid enable the push notification service or not.

Resources