Hi Jason, thanks for your reply. My problem is not how to build
AppDelegate (I did this and it is ok  when the app is active or in
background.). The question is: how to call
didFinishLaunchingWithOptions "when the ap is Killed, suspended or
terminated." ? Apple says that if an app uses "The significant-change
location service", iOS will wake it up if there's a location update to
be delivered, even if the app is terminated. But i cant make it work
using QT.

Best R,

Manoel

On Mon, Aug 22, 2016 at 6:54 PM, Jason H <jh...@gmx.com> wrote:
> @implementation QtAppDelegate
>
> +(QtAppDelegate *)sharedQtAppDelegate{
>         static dispatch_once_t pred;
>         static QtAppDelegate *shared = nil;
>         dispatch_once(&pred, ^{
>                 shared = [[super alloc] init];
>         });
>         return shared;
> }
>
> ...
>
>
> void QtAppDelegateInitialize()
> {
>         [[UIApplication sharedApplication] setDelegate:[QtAppDelegate 
> sharedQtAppDelegate]];
> }
>
>
> // int main() {
>
> #if defined(Q_OS_IOS)
>         QtAppDelegateInitialize();
> #endif
>
>
>> Sent: Monday, August 22, 2016 at 4:47 PM
>> From: "Manoel Neto" <manoelne...@gmail.com>
>> To: interest@qt-project.org
>> Subject: [Interest] Location when the App is Killed/Terminated/Suspended
>>
>> Hi ,
>>    I'm building an APP using QT/QML for IOS / Android and need to use
>> location when the APP is Killed, suspended or terminated. For IOS i
>> did an Objective C implementation and used
>> startMonitoringSignificantLocationChanges method  from
>> CLLocationManager class.
>>
>> Briefly, I extended the QIOSApplicationDelegate to have access to the
>> didFinishLaunchingWithOptions method. There i check the option key "
>>  UIApplicationLaunchOptionsLocationKey" and, if ok, start monitoring
>> Location using a LocationManager Delegate. The Background App Refresh
>> is enable for the Location updates to work in the background.
>>
>> I folow an example code (in IOS) tha works great even when the app is
>> Killed, suspended or terminated.  The only diference from my QT code
>> is that in QT i use QIOSApplicationDelegate instead of system delegate
>> in IOS. But in QT the didFinishLaunchingWithOptions is never called
>> when the ap is Killed, suspended or terminated.
>>
>> - (BOOL)application:(UIApplication *)application
>> didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
>> .....
>>     shareModel = [LocationManager sharedManager];
>>        if ([launchOptions 
>> objectForKey:UIApplicationLaunchOptionsLocationKey]) {
>>             [shareModel startMonitoringLocation];
>>        }
>>  }
>>
>> Any suggestion?
>>
>> Best R,
>> Manoel
>>
>>
>>
>>
>> --
>> Manoel Carvalho Marques Neto
>> manoelne...@gmail.com
>> _______________________________________________
>> Interest mailing list
>> Interest@qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>



-- 
Manoel Carvalho Marques Neto
manoelne...@gmail.com
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to