Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-08-2011, 02:08 PM   #1 (permalink)
learner2011
 
Join Date: Mar 2011
Posts: 115
ashwinr87 is on a distinguished road
Default Showing an alert/notification in Iphone at a particular time

I would like to know what IOS functionality to use to enable me to display a alert/notification at a particular time on the iphone. The time would be set either by the user or the developer using the UIDatePicker. Running the Local Notification Tutorial, the alert/notification is getting displayed only when the app is in the background(please correct me if I am wrong)

It would be great if someone could help me out with this
ashwinr87 is offline   Reply With Quote
Old 06-08-2011, 02:31 PM   #2 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 864
nobre84 is on a distinguished road
Default

When your app is in the foreground, it won't pop the message for you, but you will receive a
Code:
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
in your app delegate, that you can use to retrieve the contents of the notification and pop your own alert if you wish.
nobre84 is offline   Reply With Quote
Old 06-08-2011, 02:56 PM   #3 (permalink)
learner2011
 
Join Date: Mar 2011
Posts: 115
ashwinr87 is on a distinguished road
Default

thank you for the reply..
I have been trying to find out how exactly to do that but I am unable to do so..
would you be able to help me out?

Quote:
Originally Posted by nobre84 View Post
When your app is in the foreground, it won't pop the message for you, but you will receive a
Code:
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
in your app delegate, that you can use to retrieve the contents of the notification and pop your own alert if you wish.
ashwinr87 is offline   Reply With Quote
Old 06-08-2011, 04:27 PM   #4 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

you use UIAlertView to popup your own alert, if that's what you are unable to do.

If you post your code, we may be of further assistance.
smithdale87 is offline   Reply With Quote
Old 06-09-2011, 08:26 AM   #5 (permalink)
learner2011
 
Join Date: Mar 2011
Posts: 115
ashwinr87 is on a distinguished road
Default

thank you.. the thing is I know how to use UIAlertView.. I dont know how to code to make the UIAlertView pop up at the specified time...
In the tutorial I specified, they use
Code:
localNotif.fireDate = itemDate;
    localNotif.timeZone = [NSTimeZone defaultTimeZone];
which I think makes the local notification fire at that time where fireDate is the time specified..
how do I do this using UIAlertView?

Quote:
Originally Posted by smithdale87 View Post
you use UIAlertView to popup your own alert, if that's what you are unable to do.

If you post your code, we may be of further assistance.
ashwinr87 is offline   Reply With Quote
Old 06-09-2011, 08:31 AM   #6 (permalink)
Registered Member
 
Join Date: Nov 2008
Posts: 864
nobre84 is on a distinguished road
Default

Seems like you didn't understand my post. When the fireDate comes, and your app is in the background, the system alerts the user for you. If your app is open, no message will come up, but your App Delegate class will receive a call to the method I posted above. At that time, you can choose to show an UIAlertView
nobre84 is offline   Reply With Quote
Old 06-09-2011, 08:32 AM   #7 (permalink)
learner2011
 
Join Date: Mar 2011
Posts: 115
ashwinr87 is on a distinguished road
Default

yes.. I was not able to understand your post earlier but now I got what you were saying.. thanks for the help... will try it out and see if I can implement it...

Quote:
Originally Posted by nobre84 View Post
Seems like you didn't understand my post. When the fireDate comes, and your app is in the background, the system alerts the user for you. If your app is open, no message will come up, but your App Delegate class will receive a call to the method I posted above. At that time, you can choose to show an UIAlertView
ashwinr87 is offline   Reply With Quote
Old 06-09-2011, 08:45 AM   #8 (permalink)
learner2011
 
Join Date: Mar 2011
Posts: 115
ashwinr87 is on a distinguished road
Default

I tried it out and it worked!! thank you very much!!!

Quote:
Originally Posted by nobre84 View Post
Seems like you didn't understand my post. When the fireDate comes, and your app is in the background, the system alerts the user for you. If your app is open, no message will come up, but your App Delegate class will receive a call to the method I posted above. At that time, you can choose to show an UIAlertView
ashwinr87 is offline   Reply With Quote
Reply

Bookmarks

Tags
ios, iphone-sdk, uialertview, uidatepicker

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 325
7 members and 318 guests
chemistry, Dnnake, iOS.Lover, jenniead38, lendo, pbart, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:19 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0