7 Replies Latest reply on May 18, 2016 12:35 PM by mikebeargie

    how do i run a script on iOS wake

    jlisburn

      I want to force Go to run an FM script each time Go/iPad wakes from sleep. My users are not good at logging off so OnFirstWindowOpen only gets run once in a blue moon.

      I want to run a check before the user gets to start working on the solution.

        • 1. Re: how do i run a script on iOS wake
          mikebeargie

          FIleMaker Go doesn't have any triggers attached to iOS hibernate actions. It gives a best attempt to reconnect or reopen files, but sometimes this can fail if the internet connection is lost. Maybe onRecordLoad or another layout script trigger would work better for you, rather than window triggers.

           

          Allowing iOS devices to even enter a hibernated state while FMGo is open is potentially dangerous, and databases have been known to get corrupted from such occurrences. I usually turn off auto-lock on users iOS devices and put a big fat "exit app" button somewhere on my interface. Closing the file/app when they are not using it is the most reliable and secure method.

           

          Another idea would be to force a periodic timeout using the built in fmreauthenticate privilege set.

          Read up on disconnecting/reconnecting here:

          https://www.teamdf.com/blogs/14-for-14-reconnect-with-your-databases/

          • 2. Re: how do i run a script on iOS wake
            mikebeargie

            Incidentally, it might be possible to write a custom iOS app that opens a filemaker URL when waking from sleep, it just would not be native in filemaker and would require you going down the xcode rabbit hole, or hiring a developer to make the app for you.

            • 3. Re: how do i run a script on iOS wake
              rgordon

              You could use an Install Ontimer Script step to set the current time stamp.  When FMGO hibernates the script will stop but will resume when FMGO wakes up. Compare the previous timestamp with the current time stamp. if the interval is greater than the interval of the install ontimer script, this would indicate that fmgo was asleep. I'm not a big fan of having a script always running, but it might solve your problem.    Another option is to store when the OnFirstWindowOpens happens and then run a check every now and then to check when was the last time it happened.

              • 4. Re: how do i run a script on iOS wake
                coherentkris

                Mike,

                 

                Would you reccomend

                OnLastWindowClose ...

                ---Script---

                close any open files

                exit application

                --------------

                 

                 

                Exit button on interface fires OLWC script?

                 

                Or some other method...

                • 5. Re: how do i run a script on iOS wake
                  mikebeargie

                  Not really in that order,

                   

                  Exit Application will run all of the OnLastWindowClose actions anyways, so I keep those separate.

                   

                  So really I just have a script that uses close file (for users that only use one file on FMGo, launch center is ok as an exit point most of the time) or exit application (for apps that have custom launch shortcuts or they are using multiple files).

                  • 6. Re: how do i run a script on iOS wake
                    coherentkris

                    Ive got two external files open because of gozync...

                     

                    so OLWC script would be

                    close file 1

                    close file 2

                    close current file

                     

                     

                    button = exit application?

                    • 7. Re: how do i run a script on iOS wake
                      mikebeargie

                      A button running "exit application" will close ALL files. As each file closes it will run it's OnLastWindowClose action automatically. Once all the files are closed, the application itself closes.

                       

                      The client's need is what determines what I script for a button or for trigger scripts, but that's the fundamental order of operation.