Alert user with UIAlertView - iphone

Just need your thought on a problem and how to approach it.
I have an app that normally doesn't ask to connect to the web (unless user desires to send an email from within the app).
I d like to inform the user every now and then BUT not all the time with lets say i.e. news and daily tips etc at start up.
How would you approach this?
Would I just pop a uialertview at startup? And how do I prevent it from poping up all the time and only pop up whenever I have something new to say?
I'm a bit lost here, and any help would be appreciated.
Thanks

rising a notification which declares the time as approached to display an alert view is a good idea as stated by jignesh.
add a notification to the method or scenario which states the situation to display an alert and when the situation occurs just display a alertView.
hope it helps u
TNQ

You can implement push notification to alert the user about new things come from server....

Ok, here's my idea.
You need a feed on your server. This you can send a time to. The time you send will be the last time you checked for new messages. The script on the server needs to return all messages AFTER the time you send.
On the app you will get the response (probably best in plist or xml format) which will contain all new messages you want to send (after the time you sent). At this point you now want to log the current time. You should use an NSUserDefault for this (so you can get all NEW messages from the server next time). You also want to put the new messages into an NSUserDefault (use a mutable array of strings).
On starting the app you want to check your NSUserDefaults to see if there are any messages (if([[defaults messagesArray] count] > 0)). If there are then UIAlertView them (one at a time). And after you do [alert show] you want to remove them from the array.
Just thinking off the top of my head, let me know if none of that makes sense! :p

Related

how to add progress message in google home dialogflow

In my conversation dialogflow, I would like to add some progress messages like hang in with me, I'm looking up for that data or similar in the conversation. Is there any guidance or best practice to do this?
Unfortunately, there is no good way to do this at this time. If your webhook takes longer than about 5 seconds, Dialogflow will return one of the default responses it is set with. If you're not using Dialogflow, the Action SDK will say your webhook isn't responding and will close the conversation.
There is currently no way to send a reply, and then send another reply without the user saying something first.
One workaround might be to have the default response be something like "I'm looking that information up. Ask me again in a few seconds." When your lookup finally completes, cache the information so when/if the user asks the question again, you can return it more quickly.
Depending how long it takes, you may also wish to register a dynamic reprompt. This will send an event to your webhook if the user doesn't say anything. In a situation like this, they may say nothing for a few seconds, but that may be long enough for you to have computed the reply. So after a few seconds of silence you can suddenly announce "I've figured it out, the answer you were looking for is..." or something similar. This has some limitations - you can only reprompt twice like this before Google sends you a final reprompt and closes the conversation.
Although the platform does support notifications, these are still in developer preview and don't work with all devices. They also don't quite continue the conversation (it doesn't just start talking) - they just send a notification to a phone that there is a message and that they can restart the conversation. Depending on your use case, this may be useful combined with the above.
Update
The Media Response includes a feature that we can take advantage of to handle this. Similar to the dynamic reprompt method above, you'll get a call automatically when the media you're playing ends. So you can play a short "hold music" and your webhook will be called when it is finished. You can then either give the result or say you're still working on it and play more hold music.

How to update body of repeated local notification in iOs 10?

I created a local notification with Swift 3. The problem is that I want to change the body of local notification.
For example:
- There are 15 left issues.
20 minutes later:
- There are 10 left issues.
Can anybody help me, please?
After research I can almost confirm that it is not possible to update the repeated notification without app being foreground.
When you schedule a repeated push notification, the title and body is already set. In order to change the tile and body we will need to catch notification. However, according to this answer, notification service extension only works for remote notification but not local notification.
SO... How to achieve this using work arounds?
I can think 2 ways to do this.
Schedule approx 60 notification manually and preset the title and body. However, in your case, it is still not possible because you will never know how many issues left after 20 mins?? If you can pre-calculate, then you can use this solution. The disadvantage for this is it can only schedule for 64 local notifications and each time when push a local notification it creates a new delivered notification stay in the system which will spam user's notification center.
The second way is to use Notification Content Extension. NOTE: You can still not modify the title and body for the notification delivered. However, you can create a custom screen when user force touch the notification bar. Maybe the subtitle can be something like force touch to see how many issues left and implement a custom screen to show the number of issues when user force touch on it.
I am still experiment on this. There's one more option that I want to suggest is you can always do a remote push notification if issue number changes, which might be a better user experience in your case instead of pushing a repeated one every 20 mins.
Useful Reference
Here is a tutorial I found useful for Notification Content Extension.
To understand more, here is a link to WWDC of introducing notification service extension and notification content extension.
I believe you can use Notification Content Extension. You kinda have much more freedom since you are working with a view controller. I would use that!

Is there a method being called when a user removes my app from iphone

I would like to know if there is a way to know if a user removes my app from his iphone (permanently).
(I would like to handle this kind of event in order to remove it from my DB on my server)
Thank you.
Simple Answer. No. Your best option is to check for inactivity for x amount of time and assume that means it's deleted.

Send notification each day with different information

i want to send a notification each day at the same time with different information. I got no problem with showing the alert when i want to. The problem is what to show. First i tried to schedule one alert every day with different information in them, but that seems really inefficient. Then i tried with
-(void)application(UIApplication*)app didReceiveLocalNotification:(UILocalNotification *)Notif{}
but found out that it runs when the application is running in foreground only.
Is there any way to provide an array or something like it with the alert and tell the alert to get its body from the array with different index for different days?
Or should i do it with some notification that can run when the app is in background mode and the alert show and make a new alert?
All information must be provided when you schedule a local notification, so no, a notification's body cannot be sourced from an array as you described. If users are likely to open your app often and you know notification content in advance, perhaps you could ensure that x notifications are always scheduled (could be achieved by inspecting UIApplication's scheduledLocalNotifications).
This solution isn't ideal though, as it relies on users opening your app on a (somewhat) regular basis. I think push notifications are probably your best bet, but that requires access to a server, etc.
Yeah push could prob be the solution. But i dont have a server for that. The users will most likeley not open it any more after they have opened it the first time to activite the local-messages. So then this isnt really possible to do without push. when i tried a for-loop to schedule 250 days with different text each day it took about 2 minutes on iphone 4 so its not duable.

How would I get SMS/Phone events, and act on them before they're sent to the system apps?

I'm trying to develop an application for a jailbroken iPhone similar to Mcleaner or iBlacklist.
What I want my app to be able to do is intercept SMS or Phone events and handle them before they're sent to the appropriate receiver. So for example, I want the application to get an SMS event, compare the sender to an array of numbers, and either process the data or ignore it and pass it off to the SMS app.
In MCleaner, you can define a blacklist of numbers, and if a text message is received that matches the blacklist the user won't get an alert from the phone and the data is instead handled by MCleaner.
How would I go about getting these events, and further, how would I get these before the appropriate apps receive them? From what I understand, I'd need to become a first responder for these things, but I really have no clue where to start. I can't seem to find any hints on how I'd go about this as this app will not be calling apple classes to get the data..
Thanks.
I can only guide in with this, sorry, the code isn't mine to give.
In memory, all the action calls are all just pointers. What you have to do is over ride the pointer to make it point to your own function. Once you do that, you do w/e you want in your function, and then call the default function call. This ensures the integrity of the action calls and allows you to intercept the actions.
You need to use the CKMessage class.
Check this out: http://hexorcist.com/private_frameworks/html/interface_c_k_message.html
and this: http://www.ifans.com/forums/showthread.php?t=232745