User Tag List

Results 1 to 10 of 10

Thread: Apps that keep running, even when returned to home/lock screen?

  1. #1
    Clicker Fusion 2.5Android Export Module

    Join Date
    Feb 2014
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Apps that keep running, even when returned to home/lock screen?

    I am writing an Android application that can be considered a bit like a stopwatch/gps logger type thing. Effectively, user configures some options, hits "go" and then puts the phone in their pocket whilst they (physically) run for a while. During this time, I would like the app to keep running under the lock screen (so keypresses whilst it is in the player's pocket don't interrupt it). I would also ideally like it to continue to play sounds at predetermined points as a timer counts down.

    ----

    In terms of settings I have at present:
    On the Android properties tab for the application, I have the back button disabled. I also have the "End Application when not in foreground" button unchecked. Build API is 14, minimum Android 2.2 and the .apk builds and installs fine.

    Runtime options (not sure how relevant these are) that I could image may alter this are "run while minimised" and "run while resizing" enabled. Also set to not mute samples when application loses focus.

    The behaviour at the moment is that when I do exit back to the home screen of the phone is that the app effectively seems to pause; when I open the app again, it resumes at that point (as opposed to starting again on the title screen).

    -----

    I effectively see three possible outcomes (best->worst):
    1. There is some way to make the apps keep running "in the background" and playing sounds during this time that I have missed.
    2. The app will always pause, however, there is some way of taking note of the system clock of the android device at the moment the app is minimised/closed, then when it opens up again (when the player wants to check their progress) it could compare the new system clock timestamp to the one recorded when it shut down and work out the difference and from this update the internal timers to work out how much time has elapsed.
    3. There is no way to stop this behaviour and it would be necessary to root the device, disable the home button and then implement some form of "in app lock screen" of my own, so that players leave it running whilst it's in their pockets.

    I was wondering if anyone could offer advise on how best to achieve (any of) the above? Many thanks in advance.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module

    Join Date
    Jul 2006
    Location
    S.East England
    Posts
    744
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd love to know this too. It kinda breaks my app otherwise.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,344
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    CeriJC's second outcome is the valid one. The app cannot run in background, but you can find out how long it has been inactive.
    Get the time off the Date & Time object. I don't think you can get a timestamp right away, so you need to convert the actual date and time into seconds. Store the seconds in a counter you name SystemTime.
    Create a counter named AppTime and always set its value to the value of SystemTime, but above that event, set a counter named TimeDiff to the time difference between SystemTime and Apptime. As this event will run after you set SystemTime, but before you set AppTime, if the app was inactive, the two counters will now have two different values before AppTime is updated. You can therefore easily see how long the app has been inactive.

    I've tested this method on Android and it works just as intended

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module

    Join Date
    Jul 2006
    Location
    S.East England
    Posts
    744
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi popcorn I think I get what you mean. If you still have the mfa file ( if at all) I'd love to see an example.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,344
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Here's the app I made. The group labeled 'Time adjustment after inactivity' it's the one you want to study.
    Attached files Attached files

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module

    Join Date
    Jul 2006
    Location
    S.East England
    Posts
    744
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. Looks really good! I'll check it out properly later.

  7. #7
    Clicker Fusion 2.5Android Export Module

    Join Date
    Feb 2014
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks so much popcorn! I had an alert set up on this thread, so was really pleased to see someone responded.
    Although I couldn't open your example (I can't find the fontpacker anywhere!), from your description, I was able to make an implementation. Just tested it this morning on the phone and it works perfectly.


    I had been getting desperate; I'd just bought AGK2 and was slowly resigning myself to having to invest hundreds of hours in learning that the level where I could port my app to that. I'm very happy that something which had stalled for 2 years (I had the problem long before I posted) can now be completed.

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,344
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Ah, that's great to hear, CeriJC! I'd think you'd long since forgotten about it I guess it's not so bad resurrecting old posts, then

    I can upload the file without the font packer if you would ever need it, but sounds like you got it all sorted

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module

    Join Date
    Jul 2006
    Location
    S.East England
    Posts
    744
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've spent a while trying to get this working, with no much luck. If anyone else has an example that's a bit more straight to the point that would be great (i'm sure it would be good on nivrams examples anyway).

  10. #10
    Clickteam Clickteam
    Danny's Avatar
    Join Date
    Aug 2007
    Location
    United Kingdom
    Posts
    3,006
    Mentioned
    21 Post(s)
    Tagged
    2 Thread(s)
    Just an FYI - Font Packer is a Developer-Only extension but I will try and get it uploaded to the ClickStore available for purchase for Standard Users.

Similar Threads

  1. how do you unlock an object you lock on the screen?
    By dascribe in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 1st September 2012, 06:27 PM
  2. how switch on the led (caps lock, scroll lock, num lock) in the keyboard??
    By daniele in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 24th April 2012, 12:09 AM
  3. Wish there was a 'lock/unlock screen' -short rant-
    By Tiny in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 8th December 2010, 12:31 PM
  4. [Request] Suppress Windows key lock in MMF apps
    By JoKa in forum Extension Development
    Replies: 2
    Last Post: 16th February 2010, 05:36 PM
  5. HWA Apps Not too happy after you lock your PC...
    By ClickerGuy in forum Hardware Accelerated Runtime
    Replies: 20
    Last Post: 18th January 2008, 03:03 PM

Posting Permissions

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