Read file error

Previous topic - Next topic

Kyo

I use this simple code:

Code (glbasic) Select

SETCURRENTDIR("Media") // go to media files

AUTOPAUSE TRUE
SEEDRND GETTIMERALL()

//SETSCREEN 9999,9998,FALSE
SETSCREEN 440,700,FALSE

int_sd$ = PLATFORMINFO$("APPDATA")
ext_sd$ = PLATFORMINFO$("DOCUMENTS")


WHILE TRUE

PRINT "Int_sd: " + int_sd$, 0, 10
PRINT "Ext_sd: " + ext_sd$, 0, 20

PRINT "Path: " + GETCURRENTDIR$(), 0, 30

PRINT "**************2", 0, 50

OPENFILE(1,"1.txt", TRUE)
READLINE 1, nome$
PRINT "1 : " + nome$,0 ,70
CLOSEFILE 1


SHOWSCREEN
WEND


In Windows work fine but in Android Crash...
I use DOESFILEEXIST() but it tells me that the file does not exist.

I test a various option:
OPENFILE(1,"Media/1.txt", TRUE)
or
OPENFILE(1,"Media\1.txt", TRUE)

but the file not found!

Kyo

mmmm it's error of Android Extras .....

I do not know why but it does not work the command: SETCURRENTDIR("Media")


Ian Price

Quote from: Kyo on 2014-May-29
mmmm it's error of Android Extras .....

I do not know why but it does not work the command: SETCURRENTDIR("Media")



I don't think this is an AE issue - Android's file system seems to be problematic with GLBasic. From my own personal experience with OUYA and GameStick (both Android deveices) AE has helped in lots of areas where GLBasic falls far short. Try compiling your GLB program for Android without AE and see if you get the same result.

In AE you need to use Android.Check_Asset("") prior to loading media using the standard LOADANIM etc. commands

Remember Android is very specific with regards to case sensitivity too, which include the format (eg .png/.PNG etc.)
I came. I saw. I played.

spacefractal

SETCURRENTDIR("Media") is done automatic with AE. This is required so Android.Check_Assest() could work, so they looking in the same path. This is due SETCURRENTDIR() did not set dir in the Java part, only in c++ Part.

But you need add Android.Check_Assest(file$) before any loading commands. Its to skips the ... screen.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kyo

Thanks for reply!

But ADmob works????
How to set a Banner Positon, Dimension etc????

spacefractal

only fullscreen ads works, not onscreen banners. Again, see Android Sample.

PS. Can this thread moved to the glbasic en forum, this is not a faq me thinks.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

MrTAToad

You should be checking the result from OPENFILE too - as it could be failing there...

spacefractal

you still need a Android.Check_Asset("") if you using internal txt file. There is also Android.Android_DirCopy (here im forget to remove Android_ from the function name, if you want to copy the whole dir from the apk to the memory.

Etc glbasic can only read from the internal/sd memory, not from APK file, which is in AE not copied automatic. That hence you need those commands.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kyo

Thanks for help and sorry for having written in the wrong section!  :booze:

I'm waiting for the version which you can block then autolight off .

Thank for your BIG work spacefractal  :nw:

spacefractal

until im release a new AE, which im do in this incoming weekend, you can add this line in the public class SDLActivity extends Activity { class in SDLActivity.java, just before // >>>>>>>> END ANDROID EXTRAS <<<<<<<< line (around line 414):

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

this keep the screen on.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kyo

Thanks spacefractal you are Boss  :nw: