Share documents with your device (iOS, WebOS, Android)

Previous topic - Next topic

Kitty Hello

If you want some documents to share when synching with your PC/Mac, you have these options:

iOS
In the info.plist add the key: UIFileSharingEnabled=true
Be sure to set the "CFBundleDisplayName ".
You can not see the PLATFORMINFO$("DOCUMENTS") directory in iTunes.

WebOS
You can read/write to "/media/internal", which is the root directory of the USB-drive when connected.
There is a sub-directory "appdata/com.yourcompany.yourapp", as well if you want to put data there instead of the root directory.
Also "/media/internal/downloads" exists, so lots of choices for you.

Android
You must access the Java function " getExternalStoragePublicDirectory()" for this. You do this with:
Code (glbasic) Select

IMPORT "C" const char* android_ext_storage_pub_dir()
LOCAL and_dir$
and_dir$ = android_ext_storage_pub_dir()

and defaults to " /mnt/sdcard/Download" on my device. (which does not exist unless you downloaded a file. Make sure you create this if it's not there).
You need to check for
Code (glbasic) Select

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

in your AndroidManifext.xml file.

Now the best!!! (Drumroll)
If you have CyanogenMod installed on your HP Touchpad, you can use this function to get the very same storage directory for both OSs. That means - one app, WebOS or Android, uses the same "game state" data.
Code (glbasic) Select

// -----------------------------------------------------------
// documents directory. No "/" appended
// -----------------------------------------------------------
FUNCTION gack_project_root$:
// For WebOS -> hardcoded path that allows exchange with USB-drive
?IF DEFINED( WEBOS) OR DEFINED(PALM_PIXI)
RETURN "/media/internal/appdata/com.glbasic.gack"
?ENDIF

?IF DEFINED( ANDROID )
IMPORT "C" const char* android_ext_storage_pub_dir()
LOCAL and_storage$ = android_ext_storage_pub_dir()

IF NOT DOESDIREXIST(and_storage$) THEN CREATEDIR(and_storage$)

// one up
LOCAL pos% = REVINSTR(and_storage$, "/")
IF pos%>0 THEN and_storage$ = LEFT$(and_storage$, pos%)

INC and_storage$, "/appdata"
IF NOT DOESDIREXIST(and_storage$) THEN CREATEDIR(and_storage$)
INC and_storage$, "/com.glbasic.gack"
IF NOT DOESDIREXIST(and_storage$) THEN CREATEDIR(and_storage$)
RETURN and_storage$
?ENDIF


RETURN PLATFORMINFO$("DOCUMENTS") + "/GACK"
ENDFUNCTION



aroldo

[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

mentalthink


Ian Price

I was thinking about asking about this only recently. Cheers :)
I came. I saw. I played.

spicypixel

Probably obvious to most people but how exactly would you share documents for iOS and more specifically for what purpose. I also don't understand this...

You can not see the PLATFORMINFO$("DOCUMENTS") directory in iTunes.

What difference does this make ^
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

ampos

You can sent files to some aplications using itunes. In the app tab of your device, click on an app. It will open a window where you can drop files. This files are sent to the documents folder of the app.

You can not sent folders, just files. And you can not see what is inside the documents folder, just sent files (one way street).

The app with the "documents" windows on itunes are the ones with uifilesahring thing on.

check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Kitty Hello

one way street !?! I thought this directory was sort of a public directory.

Crivens

Mine can be a bit hit and miss depending on the app. AVPlayer for example (best video player IMHO) can lose the file list in iTunes (can still add new files). On the other hand it might be because now and again I use NetPortal (brilliant for exploring networks) to copy movies from my NAS over wifi and I think it messes with the Inbox directory a bit in AVPlayer's document directory.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

ampos

Quote from: Kitty Hello on 2011-Oct-10
one way street !?! I thought this directory was sort of a public directory.

You put me on doubt. Anyway you were the first to say "you can not see the content using itunes"
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

ampos

Crivens, if your iThing is JB iFunBox is great to access your iThing filesystem.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Crivens

No it isn't. Don't want to risk any problems with developing for it. Maybe not now but just incase Apple clamp down in the future. I'll probably do it to the 3GS once I upgrade the phone.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

ampos

Quote from: ampos on 2011-Oct-10
Quote from: Kitty Hello on 2011-Oct-10
one way street !?! I thought this directory was sort of a public directory.

You put me on doubt. Anyway you were the first to say "you can not see the content using itunes"

I was wrong. You can see "documents" folder content on iTunes (at least, itunes 10.5, the latest). And two way street (put and read files). Still, no able to create folders from iTunes.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

ampos

Quote from: Kitty Hello on 2011-Oct-01
Android
You must access the Java function " getExternalStoragePublicDirectory()" for this. It's not implemented, yet. On my TODO.
(After next update that's IMPORT "C" const char* android_ext_storage_pub_dir()

And now I need to know how/where to read/write files, so I can place jpg files on the Android and read them using GLBasic  :good:
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

spicypixel

It's a shame we can't just access the images already held on the various devices (photos etc..). Would be great for photo manipulation apps and uploading thumbnails to online high score tables (my own php mysql for that of course) but you get the idea.
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

ampos

Gernot, what about platforminfo$("photos")? 
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE