Does the mobileLockIdleTimer command work

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon Knight
Posts: 919
Joined: Wed Nov 04, 2009 11:41 am

Does the mobileLockIdleTimer command work

Post by Simon Knight » Tue Jul 31, 2012 12:15 pm

Hi,

The command

Code: Select all

mobileLockIdleTimer
does not prevent the screen and device from going to sleep in an app I writing, has anyone else managed to get it working? Are there some hidden setting within Android that I need to make?

The comments in the dictionary
Comments:
Locking the idle timer increments an internal lock count, while unlocking the idle timer decrements the lock count. When the lock count goes from 0 to 1, the idleTimer is turned off; when the lock count goes from 1 to 0, the idleTimer is turned on.
could be read as using the command in a loop along with the unlock command.
best wishes
Skids

Simon Knight
Posts: 919
Joined: Wed Nov 04, 2009 11:41 am

Re: Does the mobileLockIdleTimer command work

Post by Simon Knight » Tue Jul 31, 2012 12:26 pm

Hi I have tried the following code:

Code: Select all

on mouseUp
   if the environment is not "mobile" then
      answer " This application is only able to run on an Android device equipped with GPS."
   else
      mobileLockIdleTimer
      if mobileIdleTimerLocked() is true then 
         answer "Timer is locked"
      else
         answer "The Timer is not locked"
      end if
      RingMaster
   end if
end mouseUp
And it reports "The timer is not locked"
best wishes
Skids

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Does the mobileLockIdleTimer command work

Post by Dixie » Tue Jul 31, 2012 11:56 pm

Simon...

The 'iphoneLockIdleTimer', 'iphoneUnlockIdleTimer' do work... I have used them... I've attached a stack with which I have just tested them again before I posted...

be well

Dixie
Attachments
lockstate.livecode.zip
(1.64 KiB) Downloaded 240 times

Simon Knight
Posts: 919
Joined: Wed Nov 04, 2009 11:41 am

Re: Does the mobileLockIdleTimer command work

Post by Simon Knight » Wed Aug 01, 2012 5:44 am

Dixie,

Thanks for the demo stack. It does not work on Android but then why would iphone commands. I tried substituting Android and Mobile but no joy and I have ticked the idle timer option in the build settings.



Thanks for trying

Simon
best wishes
Skids

Simon Knight
Posts: 919
Joined: Wed Nov 04, 2009 11:41 am

Re: Does the mobileLockIdleTimer command work

Post by Simon Knight » Thu Aug 02, 2012 11:28 am

I have submitted a bug report (No.10361) and it has been confirmed as a fault.
best wishes
Skids

guucidan
Posts: 1
Joined: Thu Feb 05, 2015 11:13 pm

Re: Does the mobileLockIdleTimer command work

Post by guucidan » Thu Feb 05, 2015 11:19 pm

I struggled with this for a while. It turned out that I had not turned on the option in Android Settings. File/Stand Alone Application Settings/Android - check the "Application Permissions" option Idle Timer.

Worked perfectly after that.

Thanks

Simon Knight
Posts: 919
Joined: Wed Nov 04, 2009 11:41 am

Re: Does the mobileLockIdleTimer command work

Post by Simon Knight » Fri Feb 06, 2015 11:35 am

Thanks - I will have a look if I am able to locate my old code.

Simon
best wishes
Skids

Post Reply