Return to app from external content

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Return to app from external content

Post by SparkOut » Fri Oct 16, 2015 11:20 am

If I launch external content from my app, such as opening a pdf file with Adobe reader, when I close the external content and exit the (for example) reader app, I am returned to the homepage for my device, rather than my app where it was suspended. Selecting my app again restarts it from scratch. Other apps with similar features will return to the suspended calling app. Is it possible to set my app up the same?

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Return to app from external content

Post by Klaus » Fri Oct 16, 2015 12:15 pm

Hi SparkOut,
SparkOut wrote:Other apps with similar features will return to the suspended calling app. Is it possible to set my app up the same?
yep, why not, if you script it!? :D

I would simply write out a text file with the name or number of th last visited card before you "call" e.g. the PDF viewer
then check, when the stack opens, if that file is present, read it in and go to that card.

OK, this is a simplified explanation, but you get the picture.


Best

Klaus

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Return to app from external content

Post by SparkOut » Fri Oct 16, 2015 4:45 pm

Danke Klausimausi,
I know and use this technique for restart of apps between runs. What I was looking for is for the device to switch back to my app after pressing the back key to close external content ( like other apps do). Why does my application actually close when I launch a document?

rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Re: Return to app from external content

Post by rblackmore245 » Fri Oct 16, 2015 7:46 pm

On all of my devices when I launch PDF reader it pauses the app and returns to the app last point might be your firmware as i've written a app that uses PDF reader the google one and adobe one and both return to the app when the back button is pressed.

Are you using the launch URL method to open the PDF ?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7233
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Return to app from external content

Post by jacque » Fri Oct 16, 2015 8:32 pm

I believe this is all handled by the Android OS. Android will automatically go back through previous apps as long as they are still in RAM. But if the app you've launched needs more memory, Android will close down previously-opened apps to free up space, and when that happens you are returned to the launcher.

Is your PDF large? Or maybe Adobe Reader needs a lot of RAM all by itself?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Return to app from external content

Post by SparkOut » Fri Oct 16, 2015 8:44 pm

Yes, I am using launch URL to open PDF. Also it is happening when composing email, after sending it exits to the device homepage, not back to the app. Memory/too many open apps is not a factor, I believe.
It has just occurred to me this app is using a splashtack to launch the runtime stack, and then closes the launcher. Would this be a problem through not handling relaunch?

rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Re: Return to app from external content

Post by rblackmore245 » Fri Oct 16, 2015 9:52 pm

To be honest not sure but I have tested my app which uses PDF reader on lots of devices and they all return to the app after the PDF reader closes.

So I would try it on a different device as sounds like it's a problem unique to that device.

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Return to app from external content

Post by SparkOut » Fri Oct 16, 2015 10:42 pm

Well I couldn't claim an exhaustive test, but three completely different devices ,(tablet, phablet and phone) all have the same issue.

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Return to app from external content

Post by Klaus » Sat Oct 17, 2015 2:13 pm

SparkOut wrote:Danke Klausimausi
Hey, hey, hey, guard your tongue, bold stranger! 8)

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Return to app from external content

Post by SparkOut » Sat Oct 17, 2015 2:57 pm

But But But... I can't say "Klaus" without finishing "...imausi" - I just can't turn it off in my head.

Anyway, I can confirm, if I compile the runtime stack as the .apk to install, that will open external content, and when closing the external content, the app will resume. In the splashstack + runtime stack scenario, closing external content dumps me back to the device homepage, even if the launcher stack wasn't explicitly closed when opening the runtime.

I've played with the relaunch handler but it doesn't seem to have any bearing - the app is actually closed when the runtime stack calls the external content. Or so it seems. Any ideas how to deal with this? I'd really rather not rework the whole structure to avoid the splashstack/runtime scenario.

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Return to app from external content

Post by Klaus » Sat Oct 17, 2015 3:16 pm

SparkOut wrote:But But But... I can't say "Klaus" without finishing "...imausi" - I just can't turn it off in my head.
:D :D :D

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7233
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Return to app from external content

Post by jacque » Sat Oct 17, 2015 5:47 pm

Do you close the splash stack or just hide it? I'm just guessing, but maybe it has to be open to resume.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Return to app from external content

Post by SparkOut » Sat Oct 17, 2015 6:37 pm

I started out by closing the splashstack, but tried without closing for this reason. Either way, hitting the back button from the external content goes back to the device screen, not my app. Perplexing

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Return to app from external content

Post by MaxV » Tue Oct 20, 2015 10:44 pm

Do you use custom URL method to launch other apps from your app?
To launch a PDF viewer try also:

Code: Select all

launch url "file:///storage/sdcard0/Download/file.pdf"
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: Return to app from external content

Post by SparkOut » Tue Oct 20, 2015 11:16 pm

I'm using the launch url ("file:" & filepath) type method, with the filepath being of /mnt/sdcard/myfolder/myfile.pdf type. It works fine to open the reader.
If I use mobileComposeHtmlMail the email is generated too.
It's just when the pdf reader is closed, or the email is sent and the email app exits, I am returned to the home screen, with my app closed. This happens if I use the splashstack technique to launch a runtime stack which I can save. If I compile the app as a standalone without the splashstack to call it, it opens external content (in email, or pdf reader) and returns to the app at the point where the external app was called. With the splashstack, even if the original launcher app is left open, returning from external content dumps me out of the calling app.

Post Reply

Return to “Android Deployment”