Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bring application to foreground in ios?

I am detecting for iBeacon in background. When my device comes in a particular region application should comes to foreground.

like image 887
Shrinivas Kulkarni Avatar asked Apr 08 '14 07:04

Shrinivas Kulkarni


2 Answers

It cannot be done without user interaction. The only option is you can generate a push notification to tell the user to bring the application to foreground.

This is from the Apple documentation about this issue:

When the operating system delivers push notification (iOS or OS X) and the target application is not running in the foreground, it presents the notification (alert, icon badge number, sound). If there is a notification alert and the user taps or clicks the action button (or moves the action slider), the application launches and calls a method to pass in the local-notification object or remote-notification payload. If the application is running in the foreground when the notification is delivered, the application delegate receives a local or push notification.

like image 179
Khawar Ali Avatar answered Nov 16 '22 06:11

Khawar Ali


To answer to some comments about WhatsApp, with it, when you receive a classic vocal call, IOS use CallKit to display your call and wake up your phone, but it's not inside app. I try to make a video call with WhatsApp, and in this case, there is a notification. Press notification open app and answer to the call.

Conclusion : It's impossible to wake up app from background to foreground in IOS, but it's not really a problem because you can use notification to display what you want and get the user to your app after a touch on your notification. All of iPhone users are familiar with this kind of interaction, it's better to deal with it.

like image 25
Florient Ferrao Avatar answered Nov 16 '22 06:11

Florient Ferrao