Hi Nuno,
   Thanks for your reply.

>Maybe you need to enable a specific capability.
Yes. I did it. I add/enable some Key entries to info.plist like
"location update” under the Background Modes"

>Also, have you seen my last email? T
Yes i did have. All my call back methods are ok. My problem is they
(specially didFinishLaounchWithOptions) do not work when the app is
Killed (i mean, when the user tap the home button and forces to kill
the app).

Best R,
Manoel



On Tue, Aug 23, 2016 at 10:10 AM, Nuno Santos <[email protected]> wrote:
> Manoel,
>
> Maybe you need to enable a specific capability. For instance, in audio, to
> have audio being played when the app is suspended you need to enable
> background audio. Sometimes, this capabilities are only possible being
> enabled by using xcode, therefore you need to use qmake to generate the
> xcode project.
>
> Also, have you seen my last email? To know when the app is terminated or
> suspended you need to implement this calls on your app delegate:
>
> - (void)applicationWillResignActive:(UIApplication *)application;
> - (void)applicationDidEnterBackground:(UIApplication *)application;
> -(void)applicationWillTerminate:(UIApplication *)application;
>
> Nuno Santos
> Founder / CEO / CTO
> www.imaginando.pt
> +351 91 621 69 62
>
> On 23 Aug 2016, at 13:21, Manoel Neto <[email protected]> wrote:
>
> Hi Jason,
>    Thanks again for your interest in my problem. But as i said, i did
> my Delegate and it works good. I did something like this:
>
> #include <QtCore>
>
> @interface QIOSApplicationDelegate
>
> @end
>
>
> @interface QIOSApplicationDelegate(QtAppDelegate) // Put here the name
> of your delegate...i used "QtAppDelegate"
>
> @end
>
>
> @implementation QIOSApplicationDelegate (QtAppDelegate)
>
> - (BOOL)application:(UIApplication *)application
> didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
>
> {
>
> NSLog(@"It Works!! When the app did finish launch ");
>
> return YES;
>
> }
> @end
>
> Using this code, you dont have to set the delegate in main. It works
> perfectly ONLY WHEN the APP is in FOREGROUND /ACTIVE or in BACKGROUND.
> My problem is that i need to use this delegate to get LOCATION when
> the app is KILLED/TERMINATED/SUSPENDED.
>
> See this link
> http://mobileoop.com/getting-location-updates-for-ios-7-and-8-when-the-app-is-killedterminatedsuspended.
> Here the author gives an example of how to do this using Objective C.
> I did the same example using QT...the code compiles and run perfectly
> ony when the app is  FOREGROUND /ACTIVE or in BACKGROUND...but not
> when the app is KILLED/TERMINATED/SUSPENDED.
>
> Any idea?
>
> Best R,
>
> Manoel
>
> On Tue, Aug 23, 2016 at 12:08 AM, Jason H <[email protected]> wrote:
>
> See also: https://bugreports.qt.io/browse/QTBUG-38184
>
>
> Sent: Monday, August 22, 2016 at 11:04 PM
> From: "Jason H" <[email protected]>
> To: "Nuno Santos" <[email protected]>
> Cc: [email protected]
>
> Subject: Re: [Interest] Location when the App is Killed/Terminated/Suspended
> I wish I understood more about this:
>
>
> QIOSIntegration::QIOSIntegration()
>
>    : m_fontDatabase(new QCoreTextFontDatabase)
>
>    , m_clipboard(new QIOSClipboard)
>
>    , m_inputContext(0)
>
>    , m_platformServices(new QIOSServices)
>
>    , m_accessibility(0)
>
>    , m_debugWindowManagement(false)
>
> {
>
>    if (![UIApplication sharedApplication]) {
>
>        qFatal("Error: You are creating QApplication before calling
> UIApplicationMain.\n" \
>
>               "If you are writing a native iOS application, and only want
> to use Qt for\n" \
>
>               "parts of the application, a good place to create
> QApplication is from within\n" \
>
>               "'applicationDidFinishLaunching' inside your UIApplication
> delegate.\n");
>
>    }
>
> Thre is also:
>
> @implementation QIOSApplicationDelegate
>
> - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
> sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
>
> {
>
>    Q_UNUSED(application);
>
>    Q_UNUSED(sourceApplication);
>
>    Q_UNUSED(annotation);
>
>
>
>    if (!QGuiApplication::instance())
>
>        return NO;
>
>
>
>    QIOSIntegration *iosIntegration = QIOSIntegration::instance();
>
>    Q_ASSERT(iosIntegration);
>
>
>
>    QIOSServices *iosServices = static_cast<QIOSServices
> *>(iosIntegration->services());
>
>
>
>    return iosServices->handleUrl(QUrl::fromNSURL(url));
>
> }
>
>
>
> @end
>
>
>
> Which makes me thing you need to inherit from QIOSApplicationDelegate wiht
> your delegate and somehow assign your delegate to be the application
> delegate.
>
> But I don't know much about iOS internals.
>
>
> Sent: Monday, August 22, 2016 at 7:53 PM
> From: "Nuno Santos" <[email protected]>
> To: "Manoel Neto" <[email protected]>
> Cc: "Jason H" <[email protected]>, [email protected]
> Subject: Re: [Interest] Location when the App is Killed/Terminated/Suspended
> I think didFinishLaunchingWithOptions will only get called when the app is
> first loaded.
>
> Have you tried the following ones?
>
> - (void)applicationWillResignActive:(UIApplication *)application;
> - (void)applicationDidEnterBackground:(UIApplication *)application;
> -(void)applicationWillTerminate:(UIApplication *)application;
>
> Nuno
>
>
> On 22 Aug 2016, at 23:19, Manoel Neto <[email protected]> wrote:
>
> 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 <[email protected]> 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" <[email protected]>
> To: [email protected]
> 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
> [email protected]
> _______________________________________________
> Interest mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
>
>
> --
> Manoel Carvalho Marques Neto
> [email protected]
> _______________________________________________
> Interest mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/interest
>
> _______________________________________________ Interest mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/interest
>
> _______________________________________________
> Interest mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
>
>
> --
> Manoel Carvalho Marques Neto
> [email protected]
> _______________________________________________
> Interest mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/interest
>
>



-- 
Manoel Carvalho Marques Neto
[email protected]
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to