Go in Window on Mobile / Not Obeying Purge?

Terry Judd terry.judd at unimelb.edu.au
Sat Mar 2 17:53:24 EST 2019


While there don't appear to be suspend or resume messages on mobile you can sort of script your own resume message using a timer. If the timer is updated regularly using a send in time approach then the send will be delayed while the app is in the background. If the interval between the current and previous timer update is longer than expected then the app has been suspended and resumed. Some example code below...

on updateSessionTimer pCmd
   if pCmd = "clear" then
      put empty into pSessionTimer
      put the pendingMessages into tPM
      filter tPM with "*updateSessionTimer*"
      repeat for each line tX in tPM
         cancel (item 1 of tX)
      end repeat
      exit updateSessionTimer
   end if
   if (pCmd = "reset") or (pSessionTimer is empty) then
      # initialise sessionTimer
      put seconds() into pSessionTimer
      send "updateSessionTimer" to me in 5 secs
   else
      put seconds() into tNow
      put tNow-pSessionTimer into tElapsed
      put tNow into pSessionTimer
      send "updateSessionTimer" to me in 5 secs
      if tElapsed > 10 then
         answer "resuming after suspend" ##
      end if
   end if
end updateSessionTimer


On 3/03/2019 4:10 am, "use-livecode on behalf of J. Landman Gay via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:

    On Android, if you leave the app, the OS will remove it from RAM if it 
    needs the memory. It sounds like iOS is doing the same thing. Since 
    SivaSiva is so big, memory may be tight enough to drop the puzzle stack 
    when you come back to the app. It would depend on the RAM in the device.
    
    I don't know of any resume messages, though I wish we had them.
    
    --
    Jacqueline Landman Gay | jacque at hyperactivesw.com
    HyperActive Software | http://www.hyperactivesw.com
    On March 2, 2019 7:43:20 AM Sannyasin Brahmanathaswami via use-livecode 
    <use-livecode at lists.runrev.com> wrote:
    
    > Good morning Richard
    >
    >    "But just to clarify, the stack in question is a separate stack file, and
    >    not a substack of the one you're going to, yes?"
    >
    > @ Peter & Ralph
    >
    >      "inspectors still open for closed stack" -- that would be only desktop. But 
    >      this is on mobile. In a standalone.
    >
    > I am seeing runtime changes to the UI -- a puzzle game, you can leave it 
    > mid-way through the game, all the "tiles" left in a new location... go to 
    > another stack, go third stack, and back to the puzzle. Tiles are still 
    > where you left them So, we deem this a "bug"?  But... could be a possible 
    > use case to leave it the way it is?
    >
    > Navigation is now using  a  "back" script call
    >
    > Lib_SivaSivaPortal.livecodescript
    >
    > Handler: portal_GoStack (trimmed version for this mail)
    >
    > command portal_GoStack cardOrStackObject
    >
    >   put the short name of this stack into oStackName
    >
    >   # cannot pass quotes to these strings or you will
    >   # break the JSON, BR added utilities section to lib_SivaSiva
    >
    >   put removeQuotes(cardOrStackObject) into pTrackdata["contentTarget"]
    >
    >   if oStackName <> empty then # this is not the first run boot of portal
    >      deleteAllMobileControls # will destroy all except audioPlayer
    >   end if
    >
    >   set the acceleratedRendering of stack oStackName to false
    >
    >   if isMobile() then
    >      go cardOrStackObject in stack oStackName
    >
    > else
    >
    > # desktop: does not work to go from portrait to landscape
    > # hence:
    >
    >      close stack oStackName
    >      go cardOrStackObject
    >
    >   end if
    >
    > end portal_GoStack
    >
    > It appears that a simple hack would be
    >
    > if isMobile() then
    >      go cardOrStackObject in stack oStackName
    >      close stack oStackName
    > [snip]
    >
    > ... Which I tried... it works and does not affect performance.
    >
    > But the use case could be:
    >
    > ----------------
    > Put "wordpuzzles,journal,myTracking" into tNoCloseStacks
    >
    > if isMobile() then
    >      go cardOrStackObject in stack oStackName
    > 		If oStackname notI(is among) items of tNoCloseStacks then
    > 			close stack oStackName
    > 		end if
    > [snip]
    >
    > My puzzle fanatic users will love that! Users as the  "high end" - Level 4 
    > with 206-270 characters, (really hard!) means they can came back to it...
    >
    > but oops? On iOS, if leave the app, but don't close the app. And come back 
    > to it, the puzzle reverts to the original, default save state. (no tiles, 
    > waiting to choose "New Puzzle"
    >
    > :-(
    >
    > Aside: This means that there *is* a resume app message that is sent on 
    > mobile! Jacque has asked about this in the past....
    >
    > Now I don't know, it is a bug or not? I don’t see "this close the previous 
    > stack" anyway in the "Go" entry of the dictionary
    >
    > " Use the go command to move to another card in the current stack, to
    > open a stack and go to a card within it, or to move backward and forward
    > among recently visited cards.
    >
    > If the stack is open, is closed but loaded into memory, or is listed in
    > the current stack's stackFiles property, you can specify it simply
    > by name:"
    >
    >
    > BR
    >
    >
    >
    >
    > _______________________________________________
    > use-livecode mailing list
    > use-livecode at lists.runrev.com
    > Please visit this url to subscribe, unsubscribe and manage your 
    > subscription preferences:
    > http://lists.runrev.com/mailman/listinfo/use-livecode
    
    
    
    
    _______________________________________________
    use-livecode mailing list
    use-livecode at lists.runrev.com
    Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
    http://lists.runrev.com/mailman/listinfo/use-livecode
    



More information about the use-livecode mailing list