[Android-development] QML Timer stops if Android Activity enters OnPause

Michael Leithner michael.leithner at gmail.com
Thu Mar 5 14:00:10 CET 2020


Hello there :D
(This is my first experience with a mailing list, please let me know if I
do something uncommon)

I was wondering, if there is any detailed description on the intended
behaviour on QML Timer / QTimer related to the Android Activity Lifecycle
or if I encountered a bug.

Background:
We are using a Qt QML Application which sends a keep alive to our server
every few seconds per QML Timer, which was no problem until that point,
when I implemented the AdMob SDK.
For iOS everything just works, but for Android it seems that this Timer
stops sending requests if another Activity is opened above my Main Activity.
As soon as I call Interstitial.Show (or also with RewardedAds) and the ad
comes into foreground, my main Activity enters onPause and the timer stops
(or better say is paused until the ad is closed).

I started a thread about this behaviour in the qt forums (
https://forum.qt.io/topic/112245/timer-stops-pauses-if-activity-is-suspended-in-android/9)
where I was advised to enter this mailing list.

Now I would like to know, what the intended behaviour of the Timer should
be?
Because on iOS, it keeps notifying if an Interstitial is opened,
but as said on Android it stops.



For testing, I added a Java Runnable inside my main Activity, which reports
every few seconds --> this still gets called, after an ad is shown and the
activity enters onPause.

Then I added a QTimer within the c++ class and curiously this timer also
stops, if the activity enters onPause, but continues onExit?

Is this intentional oder did I encounter a bug? Maybe I am just overlooking
something?

Qt Creator 4.11.1 based on Qt 5.14.1 (Clang 10.0 Apple)
building for Android with Qt 5.13.2, jdk1.8.0_241, SDK Version: 26.1.1, NDK
Version: 19.2.5345600

This is happening on x86 Emulator as well as on my good ol Blackberry Priv
and an Samsung Galaxy S5

best regards and thanks for any information
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20200305/d3f0c5a1/attachment.html>


More information about the Android-development mailing list