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
--------------------------------------------------------------------------------
Standalone works on Windows but not on Android
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Standalone works on Windows but not on Android
Hi Ian,
not sure whayt might happens, but here some hints.
Are you really "copying" or set the clipboard?
If yes, don't.
LC does not create a folder automatically if it does not exist, it just exits the current script!
Hope this helps.
Best
Klaus
not sure whayt might happens, but here some hints.
LC does not support the clipboard on the mobile platform!
Are you really "copying" or set the clipboard?
If yes, don't.
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
Re: Standalone works on Windows but not on Android
Hi Klaus
Thanks for the quick response.
I'm not copying but setting as you suggested - my code for this is
So a bit stmped!
Regards
Ian McK
Thanks for the quick response.
I'm not copying but setting as you suggested - my code for this is
And I do check for the existance of my parent folder on startUp with this codelock the clipboard
set the fullClipBoardData["jpeg"] to pImageData
-- gives access to the system clipboard as jpeg
unlock the clipboard
And to save to 'disc'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
As I say works on windows but not on android.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
So a bit stmped!
Regards
Ian McK
Re: Standalone works on Windows but not on Android
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.
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.
Re: Standalone works on Windows but not on Android
What SparkOut said!
So don't use "clipboard" and be aware that iOS and Android are case sensitive OSs, so use -> specialfolderpath("documents")
So don't use "clipboard" and be aware that iOS and Android are case sensitive OSs, so use -> specialfolderpath("documents")
Re: Standalone works on Windows but not on Android
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
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