BlackBerry stop receiving push notifications - blackberry

I have signed with RIM for BlackBerry Push Service Evaluation Credentials so that i can test my push notifications implementation.
I used the low level sample as my server to send the push and i build the client side.
Everything worked well till now. Suddenly my application stopped showing the received push messages. Instead every time i send a push i can see in the right up corner an arrow loading (like something is being processed) but no push notification is shown.
Is really strange , cause i didnt do any change on my code.. Any ideas?
EDIT
Actually i found out that when i deploy the app in the device , the push doesnt work as i described. When i restart the phone though , the push works fine. I think maybe is because , i call the background process for listening for push , when the phone gets restarted. Have a look on my code: http://codepad.org/ddJvyOox
When i launch the app , i register to BIS for push but i think i dont listen for them. I do that every time the phone restarts.. Do you think this might be the problem?

Curious are you behind a firewall by any chance?
To consider adding firewall exceptions to have access for the eval/prod PPG then need to add the IP addresses below:
Eval:
68.171.224.57
68.171.224.59
Production:
74.82.67.65
74.82.67.66
74.82.67.70
74.82.71.70
Another high level check before diving deeper; are you able to login into the EVAL CP Portal URL Your credentials might have been reset/expired, if so contacting blackberrypushservices#rim.com to help with access to the portal.
On the application level, the app needs to connect to the InvokeManager signal at the beginning.
onInvoked() function would first check to see the bb::network::PushService instance exists and the appID is stored.
connect(m_invokeManager, SIGNAL(invoked(const bb::system::InvokeRequest&)),
SLOT(onInvoked(const bb::system::InvokeRequest&)));
The application will extract the push message from the invoke request by passing the invoke request into the PushPayload constructor if the action property of InvokeRequest matches the string constant BB_PUSH_INVOCATION_ACTION from the onInvoked() function.
Do any of these suggestions work? Otherwise please explain more in depth which client/server code you have implemented and the bar-descriptor file's properties.
Curious to know where are you located as there might be the likelihood of Push Service outage if Push Notifications suddenly stopped working.

Related

Testing VoIP push messages - messages only arrive in-app

I have a very simple PHP test script that initially works, using the following server config:
$domain = "gateway.sandbox.push.apple.com";
$url = 'ssl://' . $domain . ':2195';
I'm receiving PushKit notifications every time I expect them including when the phone is locked. However testing it over and over while trying to implement the server side and convert it to HTTP/2, it just stops working reliably and only seems to trigger when I'm inside the application.
Inside the application: always works
Outside of the application including just backgrounded the app: works in the beginning, then stops working
It's very hard to get it to work if I don't know if even the most basic form of sending the message (through the PHP test script works). Also it worries me that my production application might suffer from the same kind of throttling if a user is sending too many messages (i.e. mom trying to call from the hospital 10x in a row).
I do always trigger CallKit in my PushKit code path every time so I think I'm good regarding to the changes in VoIP pushes in iOS 13.
What could be the cause of this different over time? How (if possible) can I prevent it? How can I detect it?
For that one person that upvoted my question but didn’t find a response:
Killing the app makes the OS think depriotitize it and it leads to the OS not forwarding the VoIP push anymore. To mitigate this problem as a developer you need to start the debugger without launching the app, so when you open the app from the push it can attach. Then kill the app only through the stop button in Xcode.
Testers need to be instructed about this problem. If you’re sure the code works for you and it stops working for the tester, they need to uninstall the app, restart the phone and install it again. If possible never kill the app manually. This sucks, I know it.

How to update app when new data is available

I'm fairly new to app development and am having trouble figuring this out. One part of my app involves a messaging platform. Right now I am using a php web server to connect to MySQL backend. I have all the functionality of a messaging app, but I am unsure how to push new messages when they are available.
One basic solution would be to call my function to check for new messages every x amount of seconds, but obviously that's not a good solution. I have looked into Apple Push Notification Service and am unsure if this would fit my needs. When I looked into it this seems to be for sending notifications to the user remotely. However, rather than the user getting these messages displayed I would like the app to call a function instead (the function would load the new messages). Is this possible with push notifications?
Also this app is on both iOS and Android, so if there is a (possibly third party) solution that would cover both it would be ideal.
Any insight into this problem is greatly appreciated!
When you send a push notification and the app is in the foreground, the AppDelegate has a method called which allows you to execute whatever method you want.
This is only for iOS though, I don't know know it's handled in Android.

AFNetworking and Push Notifications

I am working on an application which GET and POST information to a server. I am doing so using AFNetworking framework. My aim is to push a notification to a client whenever someone posts new info to the server. Eg: a new grade is published, the student who's grade was published must receive a notification on his iDevice.
Although I am not familiar with how Apple Push Notification works, from what I read I concluded that I need to add server side code in order to trigger a notification.
Note that I don't have access to the server. Service is provided by Fedena.
Any suggestions or hints from where to start?
APNS needs a server in order to work. The usual flow goes like this:
The iOS Application asks user to enable push notifications
Upon access granted, a device token is generated and then must be sent to the server.
Your server must be setup with the proper APNS certificates generated from the Apple Developer site
Then in your server's, when a new post is created, you need to add some logic where you load all the APNS token you've received already and then send the notification to the devices.
This is a very simple flow description but I guess you understood that you need to have access to the server to be able to do what you are trying to achieve.
Some third parties exists to handle push notifications (like Urban Airship), but those push notifications are usually pushed manually from a person, and not triggered from a server event
I recommend that you can use secondary server of your own as intermediate and use it as infrastructure back bone.You can use SignalR library. Use secondary server as to create connection between two devises. One client will push events and another client will listen to events.
Here is the link to the signalR library code written in IOS.
I am currently using these library. What you can do is start hub and connection using these library.
This library allows invoking method on server. Something like this.
[_hub invoke:#"MehtodName" withArgs:params];
What i would do is to create event registry on server. So one client can listen to event on server and other can push events or vice versa.
So your student device can invoke method "subscribe to events" and server will add it into the registry list. You can create secondary service "Publish Events". Grade publisher can publish via calling this method. Here publish events will look up registry and find interested clients and call desired method on client.
Read more about signalr through this site.
Benefit of using Signalr Over APNS.
Cost Effective. As this will save you money which you might have to pay to Apple for pushing notification.
Can Easily make it cross plateform in future. Just have to impletement similar library in Android/Windows.
Quicker as the data does not travel to apple server from your server.
Worst case you can fallback to apns any day, just put push notification code in any of your secondary server methods.
I have done battery and performance testing as well and works perfectly fine.
If you wanna know, here how it handles connection which is very reliable.
SRAutoTransport chooses the best supported transport for both client
and server. This achieved by falling back to less performant
transports. The default transport fallback is:
SRWebSocketTransport
SRServerSentEventsTransport
SRLongPollingTransport
Let me know if you have anyother question. i am currently doing similar work, might be able to help you with your issue.

iOS Remote Notifications Badge Count Strategy When Network Connection Is Poor

I am trying to understand the best practice for remote notifications on iOS when the user has a particularly poor network connection or no network connection.
The scenario is such:
The user gets some remote notifications and at some point in the future opens the app. At this point I wan't to let the server know ASAP that the badge count is now zero. I am using server side badge count management as the only way you can update the icon badge reliably is in the APNS payload. However the call to the server fails as there is no network connectivity. Then the user puts the app into the background so I can't make any further calls to the server if network came back. Subsequently a new remote notification comes in but the badge number is wrong because the server doesn't know it needed to be zeroed.
Am I missing something here? Any advice gratefully received as I haven't found any articles online dealing with this scenario.
Yes, you have implemented in right way. We can't do anything if there is problem in internet connection. Badge count is managed by server only. So, whenever you open application, application will update Zero to server. Now, if it is not properly updated to server then it is not possible to manage it from Mobile side.

iOS Push Notifications: App as Provider?

I understand the basic concept of having a provider talk to Apple's Push Notification Server which then pushes the notification to the phone. Usually, the provider is an app server running on some machine somewhere completely separate from the app.
However, we don't currently have a separate server, and don't yet need one as everything is currently handled in-app. So, is there any way we can use the app itself as the provider to send a notification to Apple's server and thus to another phone?
Basic concept: we have a game and when a user completes 70% of the level, we'd like to notify his competitors that he's close to finishing the game (or that he has finished at 100%).
If it's possible, are there any security concerns with this approach?
P.S. The app already knows who the competitors are because it displays them in a UITableView.
Technically it's possible. If you include the push certificate with your app, and you have a way to send the device token of each device to all other devices that may need to push to that device, you can push a notification directly from one device to another.
However, in practice, that would require opening and closing many connections to the APNS servers frequently (you'll need a connection for each device, and every time a device loses network connection - which may happen often - you'll have to re-open that connection), which will probably cause Apple to block your app from connecting to their APNS server (since they would interpret it a DDoS attack).
Therefore you should use a server.
For future visitors to this question: we wound up ditching Amazon SNS since we spent nearly 8 hours and couldn't get it working the way we wanted. Instead, we setup Parse Push in rough 15 minutes with exactly what we wanted to do, so I would definitely recommend giving it a look.

Resources