how can i set alertbody text on runningtime when local notification is fired in ios4 develop? - iphone

i'm developing an iphone app.
i'm gonna use local notification. what i want is to set text of alertbody dynamically.
basically, alertbody is set statically when the local notification is scheduled.
but, in my app, the text should be downloaded when the notification is fired.
can i do this?
anyone help me..
thanks in advance.

You can't schedule a notification to have a custom message that is generated when the notification is fired.
If your app is running in the background you could fire an immediate local notification instead. See Listing 2-2 of this page on Apple's Local and Push Notification Programming Guide

Related

How to remove a specific push notification from notifications center Swift

my App is an app like Uber app, I sent a task to all my drivers this will be by a push notification.
But when a driver accepts the task first I need to remove the sent push notifications from all drivers devices so it won't be show in the notification center.
I search a lot about this issue, but no answers!
anyone try to delete a specific push notification from the notification center after sent it?
thanks.
You need to send a silent push-notification that triggers a local notification with a specific identifier.
This identifier should be send inside the silent push notification, that also should carry all information the driver should see in the local notification.
you need two types of push-notifications: show, hide.
got the point?

iphone push notification to trigger a method

I am not a developer as much as i am a project manager, i need to know more if the following is possible to help me decide the future of a project.
mainly my question is, can i trigger a certain method (function) in my application using the push notification ? so my app might be in the background (or not) and i want to send a push notification message that wakes the application and execute some piece of code.
if the answer is yes, can this be done without the user interaction ? so i mean without the user clicking on the push message ? to be some kind of automated, so i send the Push notification message, the iPhone receives it and execute the code, without the use interaction ?
i can set up my own APNS server if needed.
i am not looking for a code as much as i am looking for an answer if this can be done or not.
Thanks,
Yes, this is possible, as long as the user clicks on the notification. This could be done either with local notifications, or push notifications.
When an application is launched in response to a notification, the AppDelegate method application:didFinishLaunchingWithOptions: will have an option indicating the notification that precipitated the launch.
It cannot, to my knowledge, be achieved without user interaction.

Can we cancel a push notification from application on iOS5?

On iOS5, the push notification shows on the top bar and not block user. When the push notification is showing and user click our application but not the push bar, our app will launch normally. However, we want to cancel the push notification at that time. Is it possible ? Thanks a lot!
Short answer: No. There is no way you can manipulate sent notifications as far as I know.
Slightly longer answer:
Once a push request has been sent to the Apple Push Notification servers, thats it. It disappears into their system and they will then try to deliver it on a 'best effort' basis. You receive no feedback about its status or any ability to change/delete it.
The only form of feedback you can get is about which devices do not wish to receive push notifications that you tried to send to.
If you want to send delayed notifications which can be cancelled/modified at later data, either write you own solution, or use some pre-existing solution (e.g Urban Airship).

Handling Push Notification While App is Open

I have my Push Notification running. It works. I receive a notification and use
application:didReceiveRemoteNotification:
to get the incoming data and then send the user to the necessary screen.
Problem is, if you are using the App and a notification is received, it jumps to the destination screen without giving any alert/sound/anything.
I could put an alert in application:didReceiveRemoteNotification:, but then that alert would appear every time, not just when the app is running.
Ideas about how to handle this?
I would recommend checking the applicationState property in UIApplication to determine if the app is running in the background or not.

Can push notification be sent without an alert for certain actions?

I know you can register to have alerts or not when you call the push notification API. However my problem is that I want a certain class of actions to have an alert notification while no alert notification for other class of action?
So for example, an alert should be shown when we send the notification "Heart rate dropping alert!". But no alert should be shown when we send the notification "downloading updated patient data", the app should just take the notification as an instruction to being download if it is launched. And simply ignore it if it is not launched.
How to implement this?
Check Silent Push Notifications for iOS 7.In the WWDC 2013's "What's New with Multitasking" presentation, there is a section about Silent Push Notifications.
You can embed custom JSON data in the push notification, look at The Notification Payload in the Apple docs.
Update: I don't think that quite answers your question. You can send a blank notification that has the effect of cancelling any previous push notification (including those from other applications). I'm not sure if the app gets notified of that when it is actually running. If it does you might be able to do that in conjunction with a custom JSON payload to achieve what you want?
{"aps": {"badge": 0}}
You probably know this already - you can't use a push notification to launch the app on the iPhone without the user seeing a popup (apps can never run in the background on the iPhone).
However, you can display a different popup message and include different JSON data in the notification. Then if the user presses the button to launch the app ("Start", or whatever you call the button on the right) that JSON data is passed into the app. Your app can then carry out a different action based on that data.
Not possible. Push notifications cannot initiate tasks - nothing can cause an app to execute without user action. Similar question to Can I use Push Notification for this. You can trigger a sound, a text alert, or a badge value. That's it.