ios - Can I launch an app in Foreground when I enter an iBeacon range? -


i'm creating app ios using ibeacons. know, if set region monitor, framework can invoke app when enter/exit region, or turn on screen inside region. i've managed create local notification in callback well. question is, whether possible bring app foreground, if launched user?

no, not believe possible. apple's philosophy user in control of app in foreground. 3 ways bring app foreground are: (1) tapping icon, (2) tapping notification associated app or (3) through custom url launch app different app.

i have colleague has long insisted possible, tried myself today see sure. in our open source savengerhunt app, modified appdelegate's diddeterminestate method add code below try , force app foreground.

        nslog(@"attempting force window %@ foreground", self.window);         [self.window makekeyandvisible];         nslog(@"done attempt"); 

the code executed when ibeacon detected in background, , log lines showed expected. app, however, did not change foreground.

       2014-03-06 11:35:43.655 scavengerhunt[277:60b] sending notification beacon nearby        2014-03-06 11:35:43.678 scavengerhunt[277:60b] attempting force window <uiwindow: 0x14e96730; frame = (0 0; 320 480); gesturerecognizers = <nsarray: 0x14e95870>; layer = <uiwindowlayer: 0x14e961f0>> foreground        2014-03-06 11:35:43.686 scavengerhunt[277:60b] done attempt 

given doesn't work, best bet present local notification user. if tap on it, app move foreground.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -