I have a Xamarin Android app setup using the GCMClient library as recommended in the Azure tutorials. When sending a notification from code or a test notification through the Azure portal (or the Azure VS plugin) the device registration is removed and the following response is received from Azure Notification Hubs:
The Push Notification System handle for the registration is no longer valid
I have commented out all code in the app that unsubscribes the registration, tried running on an emulator with the Google API's & a physical Nexus device in both debug & release mode but still the registration is removed whenever a notification is sent.
I have also configured an existing web app to use the same Azure Notification Hub; the web app uses Chrome's web push notifications with a service worker and it works perfectly, the registration is never removed from Notification Hubs and the test messages come through every time.
I have verified the usual's; Sender ID & Azure NH connection string are both correct...
A couple of things to check:
Can you check if the credentials you have set for GCM are correct.
Use this link:
https://learn.microsoft.com/en-us/azure/notification-hubs/xamarin-notification- hubs-push-notifications-android-gcm
Make sure you register with the latest device token whenever the App opens up to make sure the registrations are up to date.
I am assuming the registrations exists before you send the notification. But just to make sure, please check your registration Id using Visual studio server explorer
See link Verify Registrations
Related
I'm using "twilio_voice" for a flutter application for generating and receiving call from app to real number and vice versa.
When I'm trying to call to a real number from app it's working fine. But when i'm trying to receive call within the app, it's not working.
When I checked at Twilio console I found "Error 52134 Invalid APNs device token".
I have already created the VOIP certificate in Appstore console and also generated a Push Credential in Twilio console. The SID also used in the backend.
In my applog I also found "Successfully registered for VoIP push notifications." as a confirmation.
But still not working.
After your app has register for the push notification, you will need to create a binding with the Push Token to the Twilio server. For that you will need an intermediate server of your own(Can be a Node js/PHP/Python server application). First you will make a rest api request to your own server from the app. The server application will send a binding request to Twilio server. Once that is done, you will receive push notification every time there is an incoming call via didReceiveRemoteNotification() delegate in AppDelegate.
For the server application sample and Rest api sample for iOS app, follow this documentation from Twilio:
https://www.twilio.com/docs/notify/register-for-notifications-ios
Got the solution.
The issue was in the registering device. I was sending fcm token to the server for registering device. But after changing it device UUID, it worked.
Also point to be noted that, you will need a different SID from Twilio for development and Testflight. SID from Sandbox credentials won't work if you running app from TestFlight.
In Parse I know you can send push notification from one device to another, but since it is shutting down soon I have looked at a lot of push notification services. But I could not find one service which allows you to push to other users. i.e. Firebase, you send out notifications from the computer. Basically I need a service when a function is called in the code it goes to certain people automatically. Any service suggestions?
If you have an own server, connect it with FCM. Then create an API using PHP to receive message and forward it to another device. You may implement a system to store the FCM token of the devices in the server.
You have 2 options:
Create you own app server that will send a push notification to either APNS/GCM according to the user device type and device token id
Use push provider. I recommend you to use OneSignal because its 100% free, support in all devices and have an SDK to any client/server side technology so if you will use OneSignal you will not need any server in-between your app and the push server.
this is the onesignal home page: https://onesignal.com/
and this is the SDK docs page: https://documentation.onesignal.com/
BTW! if you want to can also continue to use parse services because they release their service as an open source which called parse-server
so you can take and deploy parse-server to any cloud platform that run NodeJS and then you can continue to work as usual
I'm trying to detect uninstalls of our iOS app.
I read this document which gives some useful information. However, how can I understand from the error codes returned whether the user uninstalled versus disabled push notifications/has no connectivity?
I think you'll want to use the Feedback Service. When a user deletes an app, the service provider should ideally stop sending notifications to that device. But Apple does not notify the service that "this device is not using your app, dont send notifications". Technically, a device which has uninstalled your app will not make it onto this list until the next time a push notification goes to the device. So you need to poll for this info using the Feedback Service.
Periodically, you will need to hit Apple Notification servers asking it to give you IDs that have deleted your app. Once you get them you mark them in your DB as deleted thereby not sending any more notifications. This Feedback Service will tell devices that have been unregistered (app uninstalled). The part I'm not sure about is whether a user who has turned off push notifications in settings will register the same. I believe they will not show up in the feed from the Feedback Service. I am certain, however, that users who are offline and the push notification is not delivered will not be included in the list.
It would be a simple test in your dev region to try the app, disable push notifications for the app, and then see if the device shows up in the feed.
Take a look at Apple's documentation
From Apple Documentation -
Apple Push Notification Service includes a feedback service that APNs
continually updates with a per-application list of devices for which
there were failed-delivery attempts. The devices are identified by
device tokens encoded in binary format. Providers should periodically
query the feedback service to get the list of device tokens for their
applications, each of which is identified by its topic. Then, after
verifying that the application hasn’t recently been re-registered on
the identified devices, a provider should stop sending notifications
to these devices.
Access to the feedback service takes place through a binary interface
similar to that used for sending push notifications. You access the
production feedback service via feedback.push.apple.com, port 2196;
you access the sandbox feedback service via
feedback.sandbox.push.apple.com, port 2196. As with the binary
interface for push notifications, you must use TLS (or SSL) to
establish a secured communications channel. The SSL certificate
required for these connections is the same one that is provisioned for
sending notifications. To establish a trusted provider identity, you
should present this certificate to APNs at connection time using
peer-to-peer authentication.
Make sure you also read up on - Issues with Feedback Service
I have a native iOS Swift app talking to a Node.js Bluemix backend with MobileFirst services (AMA, Cloudant, Push iOS 8), which worked well for over a month. A few days ago I noticed that I could no longer register new devices from the iOS app (IMFPushClient.sharedInstance().registerDeviceToken() responded with a 404).
I knew that changes had been made recently to the MobileFirst services (e.g. the various push services were merged into one), so I figured I should rebind those services. This resolved the registration issue, but I haven't been able to receive push notifications ever since.
This is what I tried:
created a completely new backend with the "MobileFirst Services Starter" boilerplate
cloned the most recent version of the "Bluelist" sample app and configured it for this new backend
issued a new APNs certificate for my bundle ID and uploaded it to the push service
successfully registered for push notifications on my device. I have verified this by calling the /devices REST API (essentially, I followed these steps).
Now every time I use the REST API to send messages (after figuring out that the bearer token approach was replaced with a new "appSecret" header), I get an HTTP 202, but the notification never arrives. Likewise, when I try to send the message through the service's dashboard, I get a success message, but the notification never arrives.
One thing I noted is that the symptoms stay the same even if I don't provide the .p12 certificate to the service, so I wonder if this might be some certificate issue, but I have no idea how to trace this. Also, IIRC the "old" MobileFirst services required me to provide the bundle ID and version of the mobile app, but this seems to be gone now. Any help is greatly appreciated.
We were able to solve the issue above by making sure the sandbox environment was using a sandbox .p12 file. To verify this setting go to the IBM Push Notification Dashboard and click the Configuration tab:
Here you can see the Certificate Type of the .p12 file you have uploaded. Make sure if you are using the Sandbox environment it is listed as Sandbox. Same is true for the Production environment.
I'm developing an iOS app that enables the user to observe technical devices and be notified if there are problems.
What I know so far:
My app requests a token from the APNs.
My app sends this token to my server.
My server notifies the APNs in case of an event.
The APNs pushes a message onto the device.
What I want to know:
I read the token may change, therefor I need to request it on every app launch. Is this true?
If I get a new token from time to time I have to register at my server from time to time to make sure it uses the current token. Do I have to store and manually send the old token with the new one if the token changes to allow my server to delete the old one?
How can I detect that a user removed the app to remove his device on the server?
Highest priority in my case is for the server to know which devices are registered with the service. Old devices (old tokens that is) need to be removed immediately.
Thanks for your help.
You should register for the remote notification on every app launch and send the token to your server.
To check if the user removed the app or disabled notifications you have to check the feedback service. Look for it on this page:
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/BinaryProviderAPI.html#//apple_ref/doc/uid/TP40008194-CH13-SW1
Note: APNs monitors providers for their diligence in checking the feedback service and refraining from sending push notifications to nonexistent applications on devices.