antoniocasero / ACPReminder

Provides automatic local notifications, in order to marketing your app or explaining different use cases of your app.
MIT License
345 stars 41 forks source link

Repeat Intervals #5

Closed kmuralidharan91 closed 10 years ago

kmuralidharan91 commented 10 years ago

Scheduling Local Notifications Daily is not working for me. Can you please help me with that stuff...

antoniocasero commented 10 years ago

Could you tell me how are you defining the time periods?

kmuralidharan91 commented 10 years ago

@antoniocasero : Im trying like this ... Can you plz tell me how to get local notifications daily once...

(BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions

{

NSArray *wrd=[[NSArray alloc] init];

wrd=[wrd arrayByAddingObject:[DictionaryHelper getWordOfTheDay]]; ACPReminder * localNotifications = [ACPReminder sharedManager]; localNotifications.messages = wrd ; localNotifications.timePeriods = //what to do here// //to print each word daily localNotifications.randomMessage = YES; localNotifications.testFlagInSeconds = YES; localNotifications.circularTimePeriod = NO; [localNotifications createLocalNotification]; }

antoniocasero commented 10 years ago

Hi!

If you want daily notifications, you just need to define in the time period array:

 localNotifications.timePeriods = @[@(1)];  

and of course

localNotifications.circularTimePeriod = YES; 

Because you want to repeat the same interval defined in the timePeriods,

Just be careful with the flag "testFlagInSeconds", if you set this flag to yes, it will change the array of timePeriods in "seconds" instead of "days". (The idea behind this flag is that you can test it on your phone without wait days, remember, is only for testing purposes)

So, keep the flag like this:

localNotifications.testFlagInSeconds = NO;

I hope this help you.

kmuralidharan91 commented 10 years ago

@antoniocasero : Hi Bro... Tanx that was superb ! I needed tat only... Tank u verymuch for the answer...

Bt where to place the code if it has to run automatically for daily intervals after the application got installed... (lik didbecome active/finish launching/terminated...)

I think you can get what i'm asking...

antoniocasero commented 10 years ago

Well, I think there is a confusion, the notification is only scheduled once when user leave/close your app. There is only one notification scheduled, and once is triggered we won't schedule another one until the user open your app again.