Notifiy user Xamarin Forms SQL Server Push Notifications - firebase-realtime-database

I am developing an app with xamarin ( iOS and Android ) using SQL Server as the backend database (AWS) , and I have a requirement that when user (TestUser) insert data
for example
Table Event
id | name | date_event |
1 | TestUser| 2022-07-04 17:30
the user (TestUser) will receive a notification before 10 min as reminder.
and another requirement , the same user TestUser , can upload files , in this case all users in database must receive this information as a notification. for example all users in database will receive a notification ( UesrUser uploaded new files" )
The app consume rest api service.
i found Firebase Cloud Messaging, but with fcm we can only send a notification manually to all users.
i found also Websockets and Signal/R library, i don't know if it's utile in my case
Can anyone tell me how to implement this feature ?
Thanks in advance.

Related

Mobilefirst Plaform handle client event

I'm using mobilefirst platform 8.0 to develop my application, i'm handling back-end side, i have a question:
a client got an event like some news update, and when client hit the
button it want another clients will be get notification about. How to
do it ?
can I use adapter to send events from a client to another clients ?
No - you can't send push notifications directly from one mobile device to another...
I might recommend that you build it this way:
Mobile user 1 calls an adapter function that updates or inserts a row to a database table in the backend;
A server process detects that a new row has been inserted (maybe with a database trigger or some polling component), and calls the MFP server-side API to send a push notification for a specific tag;
All the mobile clients that have subscribed to that tag will get the notification;
-Paul Horan-
IBM

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: Unable to fetch Offline messages for XMPP Chat

I am facing an issue with the presence status, following the documentation and XMPPframework example code. I have written a chat application.
Problem : When the user 1 & 2 are online I get the status successfully and they can chat with each other. However when the user 2 goes physically offline via (Wifi OFF / 3G Off) User 1 is not getting the offline status from XMPP and hence what ever messages are sent from that instant of time are lost when the user 2 comes online.
It seems since the user 2 is not notified or stored as offline in XMPP and hence its not storing the offline messages to push back to user 2 when it comes online.
I have tried to resolve this by explicitly writing a [goOffline] call to XMPP, however the call is shown in 'SEND log' for 'user 2' but not received in 'RECV log' in user 1 from XMPP, due to which the message are lost in between.
Also tried with other sources replies.
Set status for presence available and send XMPP
priority changed with values non-negative
XMPPArchiving work but this is not what I wanted.
Server side Mod_zero push enables but get only first message push notification sometimes.
Setting limit on ejabberd.cfg file for users and offline message limit.
request for offline message pull.
Can anyone help me with this?
This is very typical situation where client losses network but server can't detect that it is offline.
To detect status of each client, server need to send PING packets to every client and wait for response.
If client responds then fine otherwise server will mark that client as offline and every other online client will be informed automatically.
Here is PING Module implementation for ejabberd XMPP Server (hope you are using ejabberd server):
mod_ping:
send_pings: true
ping_interval: 10
timeout_action: kill
ping_ack_timeout: 10
This has to be written in ejabberd.yml configuration file.
At client side also we need to enable ping module to respond to server pings as:
private var xmppPing: XMPPPing?
xmppPing = XMPPPing()
xmppPing!.activate(xmppStream!)
This code has to be written while we setupStream() for iOS.
For detailed info, please go through mod_ping documentations.
Sounds like your problem is at server level. The server thinks that the user is online so it sends the message but nobody gets it. This does not really have a simple solution.
1.
The best solution would be delivery receipts. Where basically when the message is sent to your client, your client returns a confirmation of delivery receipt. If the server does not get that receipt it would resend the message every n time. Depending on your XMPP server you might find a already made solution, of not you would have to roll out your own.
2.
A possible hack would be to have your server always store and deliver last 10 messages and then at client side you discard repeated... This also depends on your server implementation. XMPP MUC and PubSub have resources along these lines.
For a long term scalable solution, you'll need to deal with this both at server and client level.

Ping application in ios

is there any method to follow the applications on ios devices?
For instance , can I ping to ios devices on server side? or can I send silent push to device to get if application runs or not?
Thank you.
Your best bet is to let the app sending 'online' and 'offline' (combined with some unique per device id to the server) every time it gets open and closed. Then your server can store the state in some kind of database and you can read it from there if an app is currently online or offline on the client device.

Blackberry Push Implementation and waiting for acknowledgement

I already implemented the first 4 steps of the push initiator for blackberry
Send a push request
BlackBerry service returns a response
BlackBerry service pushes data to an assigned, specific port on device
Device returns response to BlackBerry service
Now I am working on the following two steps but nothing has happened yet:
5. BlackBerry service forwards acknowledgement to content provider
6. Read notification is returned to the BlackBerry service
Does anyone know how to implement that? I provided a domain when filling out the request but how do I achieve connection between me and the blackberry servers and how long do I have to wait for their response?
Actually your content provider send message to blackberry server and also specified the pin number of the device to which content provider want to send the message.
Your device automatically register with bb server if you have bb data service.
Your application is listening in the background on a particular port and your application also has particular app id that is provided by the rim.
So when content provider send message to bb server it also specify the app id and bb server has info about the port corresponding to this app id.and send message to the port of device whose pin is specified by the content provider.

Resources