Fetching data from server & adding notifications - ios

I am working on an app which fetches student info from a server, like absences and events and grades. I have no access to the server, I only have the API.
I am asked to implement push notifications in the app, such that if a teacher marks a student absent, that student get a notification about that. I searched and found several approaches:
1- Background fetch: I tried using background fetch to check if the student logged in to the app was marked absent today, if yes, show a local notification. It worked when I simulated w background fetch, but never worked on the physical device.
2- I searched for using Apple Push Notification Service, and they all wanted me to build a server, and I dont know how to start. Can I build a server which pushes notifications to devices in a way facebook does it? That is, one user triggers a notification at another user, in other words: I dont want to use broadcast notifications.
3- Using third party, like backendless, firebase or any alternatives. Would that be a useful approach?

With Backendless your app (on the student side) can register itself to receive push notifications. This is done with an API call that registers the device on the servers provided by Backendless. Then you would build an additional application (could be a browser web app or a mobile app) for the teachers. The system allows to send targeted notifications, so when a student is marked as absent, you could use the API to deliver a push notification specifically to the student's device. Would be happy to discuss in detail, you can post your question to the Backendless support forum.

For my app I have designed Push service using Java APNS library.
Or You could use Microsoft Azure Mobile services to push a notifications to devices.

Related

iOS Push Notification concept

I am fairly new to iOS development and wanted to know if my concept of how to set up and use push notifications on iOS.
So my general idea is that on each time the iOS app is opened (following Apple's guidelines) to register for push notifications and then handle the did register and failed to register methods. In the did register for push notifications I would post to my webserver the device id which I would store in the database with a last connected date.
The logic on the webserver side would be to update the existing record if the device id already exists to update the last connected date (there will be a cron job that purges device ids where they haven't been connected in the last 3 months say).
So once I have the device ids that are fairly current then I can iterate through these device ids when sending the push notifications, this way I won't be sending unnecessary pushes to devices that may not have the app installed any more.
Does this concept sound correct?
This should let you understand.

Adding notification to app that makes pdfs

I have an app that creates pdf's for the user. When this app creates a new pdf (say on the users i-pad) I want the iwatch to display a notification saying a new pdf has been created.
Does this require a server, it was my understanding apple could provide this service.
Any help or tips would be appreciated!
First to address the difference between local and push notifications. Local Notifications would be used on the specific device the user is on at the time, and is normally scheduled for a specific time such as the reminder app notifying you at a scheduled time. Push notification are sent via a server to other devices.
Since you want to send to the other devices you will want to implement push notifications. In order to do this the user will need your app on all devices. Additionally you will need to have a login system so you know which devices belong to the same user. From there you will need a push notification service that can do targeted push notifications. There are many services out there and you will need to decide which one is right for your situation.
Push notifications are sent to the device by using the device token Apple provides after the user approves notifications for your app. Each app on each device has their own device token. So in addition to targeted notifications you will want a push service that allows you to setup channels such as parse.com, that way you can setup a channel specific to each user (email, username, or ...). Then when your user logs in on any device and approves getting push notifications, their channel will be set to (whatever option you choose) and you can trigger the push notification to the specific channel and will send the notification to any device.
There are other consideration but this is a good place to start.
Local notification is just that, local to that device. Remote notification is what you need. You will either need to create a server for this purpose or use one of the variety of third-party services (Urban Airship, Parse, etc) to provide that functionality.
Clarification point -- when you say:
I want their iphone, and every other device that they have to receive a notification that a new pdf has been created
it is assumed that you mean "every device of theirs that is running your app and has approved notifications from your app". If you're trying to piggy-back on some magic AppleID-related foo, that won't be possible.

How can we notify mixpanel to send push notification programatically in ios

I have an app which is using Mixpanel. In that app I am using push notification. I could able to send the push notification manually to the registered devices list from Mixpanel profile.
My requirement is user can set reminder for persons who are in his phone book contact. Those persons should get the push notification who are using my app and accepted to recieve push notification. How can I do this if this is possible ?
I did not get any reply to this post. After that I asked to support Team. This is the reply to my question.
What is the use of People Analytics? Can it help to notify Mixpanel to send push notifications? if so how?
People Analytics is a platform that allows you to generate lists of user profiles in Mixpanel and compile unique attributes to it. For example, I created a profile for myself, where my favorite music is classical here. I can then aggregate all users who's favorite music is classical, and send a targeted push notification to them. The goal with Mixpanel People Analytics is to help you deliver targeted notifications to your users. So it's definitely the right platform to help you send push notifications through! Here's how you start storing user profiles, and here how is how you set up push notifications.
How can we send the reminder note to Mixpanel which will be send as push notification to the concerned person?
All through the UI! Through Mixpanel, you set up the push notification to have it look exactly how you want (here) and then you define the targeted criteria of users you'd like to reach.
How can we notify mixpanel to send push notification to the particular person ?
Once again, as long as you can identify those users through the unique attributes (for example, all users who's favorite music is classical) you can send them those notifications (here).
Mixpanel JQL API enables your to retrieve user device tokens via the properties $ios_devices and $android_devices. Using Apple APN and GCM endpoints, i guess your could push your own notifications via your own code with this (i've managed to retrieve the tokens, havent tried actually pushing my own way yet).

Using Firebase to send and receive push notification for an iOS app

I am create a firebase based chat application for iOS. One of the features is to send push notification to the users in the same chat room (if they are offline).
I can't find a firebase function (for iOS) that can be used to send push notifications to the user.
Is it possible?
Displaying alert badges and notifications on iPhone applications is accomplished through Apple's Push Notification system. Since the application is not running on the user's phone when they receive notifications, the APN will have to be triggered from your server-side code.
You'll probably want to create a server-side module that listens for changes to your chat Firebase. When a message appears for a user that is offline, you'll have to schedule a remote notification with the APN. That latter part has nothing to do with Firebase, but has extensive documentation on Apple's developer web site.
I'm not sure if a web application can display alerts or badges. Otherwise this approach will only work if you create a native wrapper for your Firebase chat application.

How should I send push notifications only to active devices?

I have an iOS app with a Rails backend (and frontend). I am using Parse for push notifications.
I am trying to figure out the best way to only send push notifications that will be received; that is, I want to avoid sending them to:
Users who only use the web app and don't have the iOS app
Users who had the iOS app but then uninstalled it
The way that the Parse Push API works is that I can broadcast a notification on a certain channel, and any device that is listening to that channel will receive the notifications. Therefore, I am planning to make separate channels for each user.
Obviously, I am going to need to store some sort of information on the server side about who is running the iOS app. I'm curious as to whether anyone out there has experience solving a problem like this and can offer any wisdom. Thanks!
Parse already stores information about who is running iOS and Android apps. Check out the Data Browser, there is an Installation table with a deviceType field.
Have the iOS app register a unique (per-user) channel. If you're only sending push notifications on user channels, it will only be sent to users who have installed the iOS app.
There's not much you can do for users who had the iOS app but uninstalled it. Apple doesn't provide a way for applications to run any code before being uninstalled, so you can't unregister the device with Parse. I'm not sure if Parse does this, but Urban Airship polls the APNS servers and removes devices that have had the app uninstalled after a certain amount of days.

Resources