Retrieve old push notification from parse - ios

first of all pls sorry for my question, it may appear silly, but i'm in a very early stage of IOS and parse programming.
I manage to create my app in order to receive remote push notification from parse.
I would like to save in one array all push notifications sent from parse to the app.
If i well understood, i can achieve it only if the user tap on the notification, in that way user tap on iphone , "wake" it and so i can execute the code to save the push notification.
But in case user do not tap on it, the data is lost. Same if the push notification has an expiry time, and in that timeframe i have no internet connection.
Is there a way to retrieve, from app, all the sent notifications for the app ? like i was querying any table in dashboard/data browser ?
Many thanks in advance for your help
If my request is not clear, pls tell me
B. regards
Fabrizio

You can create a new Class on your Parse Database and when you create and send you push object, you also save it in background in the new table.
So, when you need to retrieve any push notification atributes you should have them all stored in your database.

Related

Parse push notifications when data changes

This is a general question about the design direction. I am working on a weather app right now, I have user accounts, weather data from web server. I am able to retrieve the weather to the app and post these data in Parse. What I really want is that if the temperature is out of a certain range, send a push notification back to the app. So my question is how can I receive this notification when the app is not running or running in the background? Any thoughts, directions, keywords would be appreciated. Thanks!
You need to use Parse Cloud Code, to send a push notification when the server is notified about the change. One way I can think of is to schedule a job (Look at you console - Core -> Jobs) that will run let's say every hour and will check the temperature and send a push if it meets one of your conditions.
Good Luck

Refreshing data without push notification

So I have build a chat,
Right one user1 sends text to user2.
user2 gets push notification, if the app is open then using the push notification code I'm re-downloading the data from server.
So my question is, is there any way to reload data without push notification? like find when the content is available and download the data and reload the chat.
I'm pretty new ios programming so I don't know whats is exactly called or any ways to do it without getting a push and running a function.
There are only a couple of ways for a server to reach out to your app. Through push notifications (both silent and normal,) and using a socket. Sockets are more immediate but only work when your app is active in the foreground.
The only other option is for your app to poll the server. IE, for it to call a server outlet every few seconds and ask if there is any new information.

How to implement Facebook and Twitter notifications table in iPhone app

I am using Parse to deliver push notifications to my iPhone app. However, when I send notifications, they are getting cut off because they are too long. How can I make a notifications table so that when a user taps the notification, they are taken to a notifications table in the app that displays all notifications in their entirety?
Realistically, if the notification is too long to be displayed properly, it probably shouldn't be a notification in the first place. Hypothetically, you can pass the entire text of the notification you would like to display as a key-value pair in the notification payload and then use that to create a object in your app. You would have to create, add and cache the desired text in the payload and add it to your TableViewController's data source. You can use deep-linking from there to route to your custom notification table. In practice this is pretty round-about and not particularly reliable since notifications come in on a "best-try-but-no-promises" basis. If you're already using parse, you should probably consider creating objects there you can fetch with your desired info. Cloud code can handle object creation pretty easily for example.

Parse.com - Send message from Parse.com to iOS app, not like push notification

I'm developing new iOS app using Parse.com, which uses to chat between two users. What is my problem is, when User A sends message to User B, it will store in Parse.com custom class object. But I want to know, how the Parse.com let to know the User B about he received message from User A. We can fetch from User B app with some frequent time. But this is not feasible way.
So, Is there any option that parse.com will send message to specific user who received message recently? I don't want to user Push notification for this, because push notification is different concept and also not reliable.
Thanks,
Vijay.
What you are asking for is exactly what Push Notifications are for. Your only other option is polling for changes.
If you find Push Notifications unreliable you would need to implement a combination of push + polling.
There are some other technologies out there, but they're not options with Parse without a lot of middle-ware.

iOS Parse Chat App: Updating data from multiple pushes while in background/inactive.

I'm implementing an iOS chat app using Parse. Currently, most chat data is stored on the user's device.
When you send a push from one user to another, and the receiving user is on the app, the device will save the message along with its data (who it's from, when sent, etc). From there, if the receiving user is chatting with the sending user, their chat dialog will update. If they are still using the app, but not chatting with that user at the moment, a popup will display with the message.
This works great for when they are in the app.
But when they are outside of the app, a push will come through with the data (message, who sent it, when sent, etc), and a push notification will popup on the user's screen. But when they open up the app, I am not sure how to transfer that data from the push to the app's storage.
I guess I do understand how to do it (if there was only ONE push notification AND the user opened the app by tapping the push notification: there is a delegate method that seems to have a dictionary of the push notification's data).
However, in the case of there being multiple messages being sent before the user opens the app, and/or the user opens the app using the app icon (and not by opening the app from the notification), I am not sure how to access this data. It would seem like there would be some sort of way to get an array of dictionary objects, but I'm not sure.
I know I could implement a way to store the data on Parse, and then delete it when it has been downloaded, but if I don't have to do it that way, I wouldn't want to.
Any help would be much appreciated :)
You'll need to store the data in Parse and allow them to query all messages since they last checked.
I would suggest using a counter every time a message is saved, that way in the receiver you can check if that counter has only gone up by one compared to a local copy of the counter, which means you can just use the message in the push notification. If it has gone up by more than one then you know you have to ask Parse for the rest of the messages.
You can have Cloud Code that each participant in the chat calls to say what number they're up to... then you can delete anything with a value less than the lowest of all the participants. You could even integrate this logic into the getMessagesSince(counterValue) call.
Note that in this case you would also want a gotMessageFromPush(counterValue) to let the server know that you got a message via Push.

Resources