I want to use this function applicationWillResignActive perform some tasks.
before the application shuts down due to incoming call, message or user close it manually.
Can i send an email message/in app sms using this function ? Will those tasks would be performed or the application would immediately quit due to the above mentioned interrupts.
Thank you all.
Taimur
Before sending email or sms on iOS you have to display standard UI to user (either MFMailComposeViewController or MFMessageComposeViewController), but you can't present any new UI when application is going to resign active state, so the answer is no - those tasks cannot be performed
Related
I'm working on a SOS app that is supossed to send emails and/or sms when the user needs it to. This will happen using the contacts that the user added to the app. At the moment the user can add 4 of these contacts, regardles of the type (email/sms).
I'm already able to send sms OR emails using
await ChatMessageManager.ShowComposeSmsMessageAsync(chatMessage);
or
await EmailManager.ShowComposeNewEmailAsync(emailMessage);
The problem is doing both things, one after the other.
If I call both of this functions at the "same time", only one of them will show the respective page. Since OnNavigatedFrom and OnNavigatedTo events do not fire in these conditions, is there any other kind of event that fires when it comes back from the pages or some other way to wait until one of the pages is dismissed?
Thanks
Ok I've found the solution
Window.Current.VisibilityChanged
fires in this case. I'm able to figure out when the application is getting visible again and assume that the SMS was treated, launching the email at this stage.
I just start listening to the event before composing the SMS and release it when it comes back. It seem so simple now..
(Still don't know why OnNavigatedTo doesn't work)
Launch 2 SMS Compose tasks in Windows Phone 8.1 RT App pointed me in the right direction.
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.
I am developing SIP and VoIP based iOS application and requirement is that the application should be continuously running even in background also.I am using pjsip lib.
I know that to run the iOS application in bacground,we need this
Set UIBackgroundModes key in Info.plist with voip value
Created a handler that I passed to setKeepAliveTimeout:handler: for
keeping the connection alive
But I just want that if my application is running in background can I receive UDP packets over (RTP/RTCP),while I am keeping UDP port always open.
I have already gone through the posts:
iPhone VOIP in background
VoIP socket on iOS - no notifications received
But,I have not getting clear idea that can we get UDP packet continuously even the app is in background or foreground.
So that if there is any data is coming to iOS client app , the app should be able to notify the user.
Please give suggestions.
In order to run VoIP app at the background and register on a server one should use TCP on iOS. When something happens you can fire local notification.
I think you can set local notifications when the app is running in background and indicate the user of an incoming call through the notification. When the user enters the application you can show the incoming call.
In the below link, check
Background Execution and Multitasking and also Scheduling the Delivery of Local Notifications
IE since you have set the UIBackgroundModes key in Your Info.plist, your app will support long running tasks. So in the applicationDidEnterBackground method add a method which creates a UILocalNotification when there's a call. UILocalNotifications notifies the user with an alert message and a tone of your choice. So once the user is notified and user enters the app, the app will come to foreground where you can add the method for him to receive the call.
In the alert body of the LocalNotification you can send the caller's information to the user.
EDIT : Check out the answer of Paul Richter in this link, where he says
VOIP mode gives you the ability to have code running to notify you of a call coming in
but you're not going to be able to record audio from the background. If you look at how
Voip apps work, when a call comes in a Local Notification is sent informing the user
that a call is coming in. The User then must accept the call which will bring the
application to the foreground at which point from the audio side of things you can
activate your session and proceed with the phone call.
Although not completely related to the library you are using, he has given a decent explaination of the process.
Hope this helps.
I am new to iphone. I am doing Project in that i have struck in the middle because of local notifications concept.In my applications i am sending the request to the server and getting response for every 20 sec by using timer concept but when the application enter the background
how can we get the response from the server for every 20 sec by using local notifications.If anybody knows this concept please help me...
When App on background mode , you receive loacl notification, and you click yes button then
- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif
this function is call and you get dictionary
NSLog(#"%#",[notif userInfo]);
and call the xml in this function.. and you can get resonance from your server very easily
Generally, your app doesn't get to execute in the background, and local notifications won't provide you the ability to execute in the background.
(There are exceptions to this, but they come with limitations. If you really need to ping a server every 20 sec because you're something like a VoIP app, you can declare that you're a VoIP app and set up a keep-alive handler for doing that ping. However, if you're submitting to the App Store, Apple will require that you're really implementing a VoIP-like app, and not just downloading new RSS feeds in the background or some such.)
What local notifications are for is getting the user's attention when your app isn't active. While your app is running, you can schedule a local notification to post a message to the user some time later (sort of like a calendar alarm). If you're using one of the supported background execution modes, you can use a local notification to get the user's attention right now. Either way, your app only gets activated if the user chooses to tap the notification.
I want to send a notification to the user of my iOS application, preferably using NSLocalNotificaiton.
However, if the user is on a call I don't want them to recieve the notification until after the call (I don't want to interrupt their call). Is there any way to schedule the notification to occur after the call has ended?
A notification will no more interrupt a call than a calendar or SMS alert does—the alert view will appear on their screen, and if the ringer isn't silenced then the alert sound will play, but the user won't get disconnected or anything in the process. The only way you have of detecting that the user may have finished a call is the -applicationDidBecomeActive: method on your app delegate, but if your app's going to be in the foreground (which is the only point at which it'll receive that message) then you don't need to bother with a UILocalNotification. In short: no, you can't schedule things around the user's phone activity, but nor should you worry about your notifications interrupting them mid-call.