Standalone works on Windows but not on Android

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
IanMcK
Posts: 16
Joined: Mon Jul 05, 2010 10:47 am

Standalone works on Windows but not on Android

Post by IanMcK » Sat Mar 26, 2022 12:59 pm

Hi

I have a puzzle app which performs entirely as expected in the IDE and as a Windows standalone but not on Android. I have the Android SDK installed correctly.

When I deploy the app to my phone (Android 9) for testing it behaves as it should until the puzzle completes and I use the option to screenshot the completed board.

The screen is locked, the board prepared, screenshot taken, the board is reset and the screen unlocked. This should place the screenshot on the clipboard and save an image to internal storage (Documents/MPW/Solutions). This doesn’t happen.

The board is preped but the preped board can be seen and doesn’t reset.
There is no MPW folder in my Documents folder. (There is in Windows)

This process works flawlessly on Windows

The app is set to display in portrait mode only, resizes to full screen on mobile and has access to both internal and external memory.

Any help would be greatly appreciated

Many thanks

Ian McK

--------------------------------------------------------------------------------
I’m using LiveCode 9.6.6 Indy on a PC
using Win 10 Home 64 bit with 16 Gb Ram.
LiveCode is installed on the C: drive which is a SSD.

Android Studio Bumblebee | 2021.1.1 Patch 2
Build #AI-211.7628.21.2111.8193401, built on February 17, 2022
Runtime version: 11.0.11+9-b60-7590822 amd64

VM: OpenJDK 64-Bit Server VM by Oracle Corporation

Platform Tools v 33.0.0
Emulator v 31.2.8
Build Tools v 33 rc2

Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 8
Registry: external.system.auto.import.disabled=true
--------------------------------------------------------------------------------

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

Re: Standalone works on Windows but not on Android

Post by Klaus » Sat Mar 26, 2022 1:14 pm

Hi Ian,

not sure whayt might happens, but here some hints.
IanMcK wrote:
Sat Mar 26, 2022 12:59 pm
...
The screen is locked, the board prepared, screenshot taken, the board is reset and the screen unlocked. This should place the screenshot on the clipboard and save an image to internal storage (Documents/MPW/Solutions). This doesn’t happen.
...
LC does not support the clipboard on the mobile platform!
Are you really "copying" or set the clipboard?
If yes, don't.
IanMcK wrote:
Sat Mar 26, 2022 12:59 pm
...
There is no MPW folder in my Documents folder. (There is in Windows)
...
Then you need to check the existence of that folder first and create it if neccessary.
LC does not create a folder automatically if it does not exist, it just exits the current script!
Hope this helps.

Best

Klaus

IanMcK
Posts: 16
Joined: Mon Jul 05, 2010 10:47 am

Re: Standalone works on Windows but not on Android

Post by IanMcK » Sat Mar 26, 2022 3:50 pm

Hi Klaus

Thanks for the quick response.

I'm not copying but setting as you suggested - my code for this is
lock the clipboard
set the fullClipBoardData["jpeg"] to pImageData
-- gives access to the system clipboard as jpeg
unlock the clipboard
And I do check for the existance of my parent folder on startUp with this code
command checkForDataFolder
put folders(specialFolderPath("Documents")) into tAllFolders

if lDataFolderName is not among the lines of tAllFolders
then -- create folder MWP

put specialFolderPath("Documents")&"/"&lDataFolderName into tFolderFilePath
create folder tFolderFilePath -- create MWP parent Folder

put tFolderFilePath &slash& lDataSolutionFolder into tFolderFilePath
create folder tFolderFilePath -- create Subfolder for Solution Jpegs -- MWP/Solutions

end if
end checkForDataFolder
And to save to 'disc'
command saveSnapshotToDisc pImageData
-- create filename from reference number and date
put gPuzzleA["WordReferenceNumber"] into tWRefNumber

put the short system date into tDate -- dd/mm/yyyy

set itemdelimiter to slash -- change to slash to divide date
put item 3 of tDate into tYear -- yyyy
put item 2 of tDate into tMonth -- mm
put item 1 of tDate into tDay -- dd
set itemdelimiter to comma -- reset to default

-- create image title
-- title template is MWPrrrrrrrr - yyyymmdd
put "MWP" & tWRefNumber &&"-"&& tYear&tMonth&tDay &".jpg" into tImageName

-- create filepath to image file location
put "binfile:"&SpecialFolderPath("Documents") &slash& \
lDataFolderName &slash& lDataSolutionFolder &slash& tImageName into tImageDestination

-- save the image
put pImageData into URL (tImageDestination)
end saveSnapshotToDisc
As I say works on windows but not on android.

So a bit stmped!

Regards

Ian McK

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

Re: Standalone works on Windows but not on Android

Post by SparkOut » Sat Mar 26, 2022 4:10 pm

Android versions in recent years have implemented stronger security controls. I think the chances are that you cannot create folders or write to the external documents folder due to this. You would be able to write to specialFolderPath("documents") which is the sandboxed folder under the parent app - not the publicly visible external documents folder.
If after writing your snapshot to file, you check "if there is a file..." and it tells you true, then you will know whether the process failed, or worked but put the file in a non-public location.

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

Re: Standalone works on Windows but not on Android

Post by Klaus » Sat Mar 26, 2022 4:40 pm

What SparkOut said!

So don't use "clipboard" and be aware that iOS and Android are case sensitive OSs, so use -> specialfolderpath("documents")

IanMcK
Posts: 16
Joined: Mon Jul 05, 2010 10:47 am

Re: Standalone works on Windows but not on Android

Post by IanMcK » Sat Mar 26, 2022 4:55 pm

Thanks Klaus and Sparkout

I had thought that this was a permission problem and I didn't realise Android was case sensitive.

So I'll do as you suggest - use documents rather than Documents and test for the file's existance.

Many thanks again

Ian McK

Post Reply

Return to “Android Deployment”