We have moved to a new Sailfish OS Forum. Please start new discussions there.
2

QTimer suspended!

asked 2015-11-02 09:41:14 +0300

HAF-MED gravatar image

updated 2015-11-02 09:46:18 +0300

Hi,

I develop a Saifish application

I have used QTimer like this

timer = new QTimer();
connect(timer, SIGNAL(timeout()), this, SLOT(PlayAudio()));
timer->start(60000);

void PlayAudio(){
   if (time=2*3600)
      audio.play()
    }
}

but if my device sleep the timer is suspended by the OS! and the audio is not played

Rem: the timer restart if the screen of the device is on!

Please help me; what can I do to let QTimer running all time?

I use c++ for calculate the time to play *.mp3 and qml to UI and store settings.

My application must notify the user when a certain time of the day is reached.

I want that my application wake up the device from suspend at correct time and play a *.mp3

edit retag flag offensive close delete

Comments

you could do the followong:

1) check time when your timer has started

2) runOntriggered = true

3) add check if current time is more then time from 1) plus 60000

Or you can prevent your device from sleeping, although it will drain battery and it will probably won't get passed in harbour

virgi26 ( 2015-11-02 09:53:20 +0300 )edit

same thing can be done with Sailfish Clock application :)

coderus ( 2015-11-02 14:49:59 +0300 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2015-11-02 10:03:12 +0300

LVPVS gravatar image

Hei,

Or, you could use timedclient-qt5 to set your timer, just as your device does it when you create an alarm (calendar, clock).

LVPVS out.

edit flag offensive delete publish link more

Comments

can you give me more detail who to use that in my application or where can I found documentation

HAF-MED ( 2015-11-06 16:54:55 +0300 )edit
Login/Signup to Answer

Question tools

Follow
3 followers

Stats

Asked: 2015-11-02 09:41:14 +0300

Seen: 291 times

Last updated: Nov 02 '15