Recently used apps button

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
KimD
Posts: 223
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Recently used apps button

Post by KimD » Thu Jun 16, 2016 4:05 am

I've completed an Android app. Now I'm trying to create an IOS version. This is my first experience with OSX and IOS. After spending approx 1.5 days getting everything set up on my newly purchased 2nd hand Mac, I've managed to download my app onto my physical test device (an iPhone 4 running IOS 7.1).

Mostly the transfer has gone very well, but I have noticed the following. When I run my app, then click the devices home button, go into another app, then click the devices RECENT APPS button (double home button click on IOS):

In Android
- I see an image of my apps last screen state in the recent apps;
- and when I select my app it opens in the apps last state (I know - if I left it long enough Android may eventually remove my app from memory - but this hasn't happened yet)

In IOS
- I see a black rectangle with my apps name/icon below it in the recent apps; and
- and when I select my app it sometimes opens in the apps last state, but more often it starts again anew (even if I've only been out of my app for 20 seconds).

For a LC deployment to IOS - what do I need to do to:
1) get my app to have a screen image (instead of a black rectangle) when it appears in the IOS recent apps list; and
2) get IOS to re-activate my app in its last state when opening from the IOS recent apps list?

Thanks in advance

Kim

joel.epsteinBUS31vi
Posts: 135
Joined: Thu Sep 13, 2012 10:25 pm

Re: Recently used apps button

Post by joel.epsteinBUS31vi » Thu Jun 16, 2016 10:08 pm

Hi Kim -

Welcome to Livecode iOS.

For your first issue, you'll need to include iOS splash screens of the appropriate dimensions. You do this in the iOS standalone application settings.

For the second issue, you need to keep track of where the user is in your app and save this to a preference file. Then, in a preOpenStack script, restore things based on the contents of the preferences you saved. Depending on the complexity of your app, this could be fairly simple, or really rather involved.

Hope that helps.

Peace.

Joel

Adrian
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 79
Joined: Wed Jul 11, 2012 5:03 pm

Re: Recently used apps button

Post by Adrian » Sat Jun 18, 2016 11:37 am

By default, Livecode iOS apps are set to terminate when you move to another app ('suspend'). There is an iOS Standalone Application setting called (I think) Background Audio - it's the one labelled "experimental". Setting this keeps your app running when suspended, so returning to it will carry on where you left off.

Note that you must design your app to cope with this properly. For example, iOS may well terminate your app while in the background if it needs space. Your app can't do user interaction while suspended, of course.

This is new in Livecode and means you don't always have to use the alternative "save state data when exiting" approach.

Cheers,

Adrian

KimD
Posts: 223
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Re: Recently used apps button

Post by KimD » Mon Jun 20, 2016 1:16 am

Thanks Joel & Adrian

I've done some more reading. It seems like exit on suspend / quit on suspend are both supported by IOS.

In earlier versions of LC there was a tick box in the IOS Standalone Settings that allowed LC developers to choose how apps behaved on suspend, but this tick box has since been removed. I also found the following link that provides a work around for this issue - http://livecodejournal.com/forum/viewto ... ?f=25&t=90.

I'm reluctant to use the work around until I better understand why LC removed the IOS Standalone Settings tick box. Sounds like I need to do more research.

Regards

Kim

Adrian
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 79
Joined: Wed Jul 11, 2012 5:03 pm

Re: Recently used apps button

Post by Adrian » Mon Jun 20, 2016 8:20 am

That workaround no longer works; you can't change the plist. However, the Standalone Settings item I mentioned is new and allow you to set Exits on Suspend.

Cheers,

Adrian

Randy Hengst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 154
Joined: Thu Jun 29, 2006 4:16 pm

Re: Recently used apps button

Post by Randy Hengst » Tue Jun 21, 2016 1:04 am

I’m still using this hack posted on the email ‘Rev Developer List’ list by Ralph DiMola in Oct 2013. I’m using LC7.1.4 and Xcode 7.3.1


1) Duplicate the LC app
2) Browse the contents
3) In the all the folders in tools/runtime/iOS remove these 2 lines from all the Setting.plist files


<key>UIApplicationExitsOnSuspend</key>
${APPLICATION_EXITS_ON_SUSPEND}

Adrian
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 79
Joined: Wed Jul 11, 2012 5:03 pm

Re: Recently used apps button

Post by Adrian » Tue Jun 21, 2016 7:56 am

Yep, that works, of course - but not from Livecode 8. The application is packaged differently and you cannot edit plist files in this way.

I should have said "from Livecode 8", when I said "this no longer works "

KimD
Posts: 223
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Re: Recently used apps button

Post by KimD » Tue Jun 21, 2016 8:35 pm

Thanks Adrian

I've experimented with Standalone Settings > Background Audio, and it seems to do everything that I want.

"Interesting" choice of naming for this excellent feature though. I would never have thought to look there if you hadn't told me ;-)

Regards

Kim

Randy Hengst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 154
Joined: Thu Jun 29, 2006 4:16 pm

Re: Recently used apps button

Post by Randy Hengst » Wed Jun 22, 2016 5:01 pm

I admit I’ve not done much experiementing with LC8, but a quick check of the plist hack for the 9.3 simulator in LC 8.0.2 (rc2) seems to work just fine.

KimD
Posts: 223
Joined: Wed Jul 08, 2015 5:51 am
Location: Wellington, New Zealand

Re: Recently used apps button

Post by KimD » Tue Jul 26, 2016 4:12 am

An update

Today Apple rejected my app because - "Your app declares support for audio in the UIBackgroundModes key in your Info.plist, but we were unable to play any audible content when the application was running in the background.". Note that they had accepted this feature 10 days earlier, but when I submitted a new build (which didn't change anything with regard to background audio) I must have got a different reviewer with a different set of priorities.

So it appears that if you are submitting to the App Store and tick the IOS Standalone Settings > Background Audio box, then you must actually provide background audio; unless you just get lucky ;-)

Regards

Post Reply

Return to “iOS Deployment”