×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor
    Join Date
    Feb 2012
    Posts
    124

    Detecting App in the background

    I'm just trying to detect if my QML application is in the background.
    Hamishwillee says in this article: http://www.developer.nokia.com/Commu...Qt_for_Symbian
    says to detect focus lost in QML to see this other article: http://doc.qt.nokia.com/qt-component...oreground-prop
    But that link doesn't work anymore.
    Can someone provide me with a method or link to detect if my app goes to the background so I can pause it?

    Thanks.

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,037

    Re: Detecting App in the background


  3. #3
    Regular Contributor
    Join Date
    Feb 2012
    Posts
    124

    Re: Detecting App in the background

    Quote Originally Posted by vineet.jain View Post
    Thanks for the help but I was hoping to do it quickly in QML so I don't have to worry with the QML - C++ connection.
    I found this: http://doc.qt.digia.com/qt-component...l-symbian.html
    and also I found an example that used that so I'm all good now!
    In my QML file I have this:

    Code:
    function appForegroundChanged() {
    console.log(symbian.foreground)
    }
    and:

    Code:
    Component.onCompleted:{
    symbian.foregroundChanged.connect(appForegroundChanged)
    }
    It's so easy. Thanks again.

  4. #4
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,037

    Re: Detecting App in the background

    Though internally it checks QEvent::ApplicationActivate/QEvent::ApplicationActivate/ApplicationDeactivate event only

  5. #5
    Regular Contributor
    Join Date
    Feb 2012
    Posts
    124

    Re: Detecting App in the background

    Quote Originally Posted by vineet.jain View Post
    Though internally it checks QEvent::ApplicationActivate/QEvent::ApplicationActivate/ApplicationDeactivate event only
    Okay, will that be a problem? I'll test it out during phonecalls etc. It works when pressing the homescreen button.

  6. #6
    Regular Contributor
    Join Date
    Apr 2012
    Location
    malaysia
    Posts
    262

    Re: Detecting App in the background

    Did you use that qml to make your app go background when press back keys ?.How did you make your app go background when press the back key?

  7. #7
    Regular Contributor
    Join Date
    Feb 2012
    Posts
    124

    Re: Detecting App in the background

    Quote Originally Posted by babylongreece View Post
    Did you use that qml to make your app go background when press back keys ?.How did you make your app go background when press the back key?
    I don't make my app go to the background. I only detect if the app has gone to the background, e.g. home button pressed, or a phonecall has come in. When it is in the background I pause the game, stop playing music, etc.

  8. #8
    Regular Contributor
    Join Date
    Apr 2012
    Location
    malaysia
    Posts
    262

    Re: Detecting App in the background

    I though the phone automatically take care of that.I just didn't know how to make the app go background not exit when press back keys.The app pause when anything is interrupt it so i thought the phone manage itself.

  9. #9
    Regular Contributor
    Join Date
    Feb 2012
    Posts
    124

    Re: Detecting App in the background

    Quote Originally Posted by babylongreece View Post
    I though the phone automatically take care of that.
    My pure QML app was continuing to run in the background, this trick allowed me to pause the bits I wanted to pause. In QML you can use a pagestack and take over the bottom button bar
    and for the back button change this line of code:
    onClicked: pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
    to not perform QT.quit() when the back button is finally called. Perhaps there is a QT.hide() or similar but I'm not sure.

  10. #10
    Regular Contributor
    Join Date
    Apr 2012
    Location
    malaysia
    Posts
    262

    Re: Detecting App in the background

    Already tried but won't work.Also there is no Qt.hide() function in qt element.Guess need to find example project on how to do it..

Similar Threads

  1. on device N-97 background image get disappear or get black background
    By amitsharma_ujj in forum [Archived] Qt Mobility Project
    Replies: 13
    Last Post: 2011-05-06, 08:05
  2. live background like android - swf, or WRT in homescreen background?
    By shpe11 in forum Series 40 & S60 Platform Feedback Archive
    Replies: 1
    Last Post: 2010-06-15, 08:45
  3. Replies: 25
    Last Post: 2009-11-05, 16:20
  4. Replies: 1
    Last Post: 2009-04-29, 08:57
  5. Replies: 11
    Last Post: 2008-03-28, 08:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×