Skip to content

[Android] SD Card permissions. #332

Closed
Lion4K opened this issue Dec 31, 2017 · 64 comments
Closed

[Android] SD Card permissions. #332

Lion4K opened this issue Dec 31, 2017 · 64 comments

Comments

@Lion4K
Copy link

Lion4K commented Dec 31, 2017

Hi, as I believe you devs already know, theres a issue with the SD Storage access on Kit Kat or later android versions.
However I'm here to present a possible solution.

I've seen some apps bypassing this, by using android's internal file picker, and some others have implemented something that makes the app asks the system for SD Card privileges, which in its turn asks the user about it.

This may provide some help.
https://source.android.com/devices/storage/

Again, I'm not a developer, I have little to no knowledge on android developing, the most I know is to use ADB / Fastboot to custom rom procedures, and logcats.
I'm just trying to be helpful.

Happy new year!!

@mittorn
Copy link
Member

mittorn commented Dec 31, 2017

It does not work for native code and it is very slow. Yes, we may wrap filesystem to java, but it is hard task, it will not be compatible with mods, it will be slow and increase memory usage. 0.5s hanging on save,download,changelevel,graph write, reducing connection time 2-3 times because of demoheader. And it may crash/hang because of buggy implementations.
Use "rodir" feature in test versions, it is fast enough and compatible with half-life game code (but not with aghl, xdm, etc...).

@mittorn mittorn closed this as completed Dec 31, 2017
@mittorn
Copy link
Member

mittorn commented Dec 31, 2017

P.S you yell about file picker method which does not work, but android 6.0 method with /mnt/runtime may work. I do not have android 6.0+ devices to check if it useful.

@mittorn mittorn reopened this Dec 31, 2017
@Lion4K
Copy link
Author

Lion4K commented Dec 31, 2017

I can test that for you if you want. I can also point to some apps that uses that method that you may be able to take a look at and idk, make sense out of something there, idk jack about that.

@a1batross
Copy link
Member

It does not depends, request you SD card privileges or not, it will not available from native code.

Rodir is seems to be best solution here.

@Lion4K
Copy link
Author

Lion4K commented Dec 31, 2017

Solid Explorer is one of the apps that Uses that. I made a video showing how that happens.
heres the link to it: EDIT wrong video uploaded. please stand by

@Lion4K
Copy link
Author

Lion4K commented Dec 31, 2017

BTW whats Rodir? And how to get it?

@Lion4K
Copy link
Author

Lion4K commented Dec 31, 2017

Also, how ironic is that, Solid Explorer, a file explorer that relies on android's own file explorer to work. lol;

@mittorn
Copy link
Member

mittorn commented Dec 31, 2017

Does Solid Explorer performing file operations in native code?
If it uses documents api, this method unuseful for xash3d.

@Lion4K
Copy link
Author

Lion4K commented Dec 31, 2017

Here's the correct Link:
https://www.youtube.com/watch?v=EP20YbnZBc4

@Lion4K
Copy link
Author

Lion4K commented Dec 31, 2017

No I belive it's not native, at least if I understood what native is.

@Lion4K
Copy link
Author

Lion4K commented Dec 31, 2017

I mean, I have no idea.

@mittorn
Copy link
Member

mittorn commented Dec 31, 2017

Use /sdcard/xash as game folder, but leave it empty and place game data to /storage/sdcard1/xash and add -rodir /storage/sdcard1/xash to command-line arguments.

@mittorn
Copy link
Member

mittorn commented Dec 31, 2017

Documents API is only availiable in java code. It is different from classic filesystem. It is similar to downloafing files from network Instead of reading.

@mittorn
Copy link
Member

mittorn commented Dec 31, 2017

File managers "uploads" files to sdcard, and does nlt write it directly.

@Lion4K
Copy link
Author

Lion4K commented Dec 31, 2017

So "Path to game resources" I set what?

@mittorn
Copy link
Member

mittorn commented Dec 31, 2017

To /sdcard/xash which should be empty. Xash3D will write all changed files there. It will be used as overlay to read-only /storage/sdcard1/xash

@Lion4K
Copy link
Author

Lion4K commented Dec 31, 2017

could not found directory valve.

@Lion4K
Copy link
Author

Lion4K commented Dec 31, 2017

like, my sdcard path is /storage/F2ED-255F/

@Lion4K
Copy link
Author

Lion4K commented Dec 31, 2017

so my Advanced Tab should be:

Command line ar(...)
-dev 3 -log -rodir /storage/F2ED-255F/xash

Path to game resources:
/storage/emulated/0/xash

Pixel format (...)
32Bit

Keyboard does not resizes

Check updates Tick

Update to unstable Untick

enable immersive mode (...) Tick

@a1batross
Copy link
Member

a1batross commented Jan 1, 2018 via email

@Lion4K
Copy link
Author

Lion4K commented Jan 2, 2018

Oh. Where do I get this version?

@mittorn
Copy link
Member

mittorn commented Jan 2, 2018

@Lion4K
Copy link
Author

Lion4K commented Jan 2, 2018

Sorry, its probably like, "bitting me at the ankle" but I can't find it. can you please point the link to the apk file?

@a1batross
Copy link
Member

Read READMR.md file. Use "travis-latest" branch.

@Lion4K
Copy link
Author

Lion4K commented Jan 2, 2018

@a1batross
Copy link
Member

a1batross commented Jan 2, 2018 via email

@Lion4K
Copy link
Author

Lion4K commented Jan 2, 2018

thanks, gonna copy the files one more time, as google play music keeps playing the media files on the game folder.

@Lion4K
Copy link
Author

Lion4K commented Jan 2, 2018

works nicely. thanks.

@mittorn
Copy link
Member

mittorn commented Jan 3, 2018

@a1batross
No, just add .nomedia after mediascanner adds files to database

@a1batross
Copy link
Member

a1batross commented Jan 3, 2018 via email

@mittorn
Copy link
Member

mittorn commented Jan 3, 2018

I do not know if ti is bug or feature, but i do not recommend to use it as Samsung devices may have it enabled.

@Lion4K
Copy link
Author

Lion4K commented Jan 3, 2018

im using androis 7.1.1, waiting motorola release oreo.

@Lion4K
Copy link
Author

Lion4K commented Jan 3, 2018

but yeah the .nomedia file worked like a charm. not only stopped music but also pictures.

@Lion4K
Copy link
Author

Lion4K commented Jan 3, 2018

for the mods. lets say i wanna use Crack-Life.
What should I use?
folder name is cracklife.

r/n i'm using:

advanced:

cmd args
-dev 3 -log -rodir /storage/F2ED-255F/xash -game cracklife

Path:
/storage/emulated/0/xash

should I add cracklife to both lines?

@nekonomicon
Copy link
Member

You must place cracklife folder to xash folder.

@Lion4K
Copy link
Author

Lion4K commented Jan 3, 2018

yeah, it is.

all my mods are there

cracklife
clcampaign
cstrike
czero
czeror
valve
ricochet
dmc
etc etc etc

@Lion4K
Copy link
Author

Lion4K commented Jan 5, 2018

Would be this one the native thing you were talking about?
It sure does look different from the one I showed on the video.

Teste https://imgur.com/gallery/FZGTF

@Lion4K
Copy link
Author

Lion4K commented Jan 5, 2018

It asks directly to the folder and not the whole card.

@mittorn
Copy link
Member

mittorn commented Jan 5, 2018

rewrite xash3d to java and it will work

@Lion4K
Copy link
Author

Lion4K commented Jan 5, 2018

When you mean rewrite, isn't it already in Java?
I mean I thought everything in Android was Java, actually Dalvik something idk. I saw something on college but didn't pay attention.

@nekonomicon
Copy link
Member

nekonomicon commented Jan 5, 2018

Xash3d was written on pure C(menu and game libraries on C++).
Only launchers(black windows) was written on Java.
You can write apps for android on any programming language in combination with Java.
Dalvik - just Google's JVM implementation for android.

@Lion4K
Copy link
Author

Lion4K commented Jan 5, 2018

I see, I guess I should had payed more attention to college lol

@Lion4K
Copy link
Author

Lion4K commented Jan 6, 2018

Well, about the other mods, I still can't get them to work, how should I fill both lines, like, for example for CrackLife.

cmd args
-dev 3 -log -rodir /storage/F2ED-255F/xash

Path:
/storage/emulated/0/xash

Should I use "-game cracklife" on both of them?

@a1batross
Copy link
Member

a1batross commented Jan 6, 2018 via email

@Lion4K
Copy link
Author

Lion4K commented Jan 6, 2018

but the -game comes after or before -rodir? or it doesn't matter?
because it didn't worked.

I've used exactly like this:

cmd args
-dev 3 -log -rodir /storage/F2ED-255F/xash -game cracklife

Path:
/storage/emulated/0/xash

@a1batross
Copy link
Member

a1batross commented Jan 6, 2018 via email

@Lion4K
Copy link
Author

Lion4K commented Jan 6, 2018

hm, yeah, it does not work at all.

@Lion4K
Copy link
Author

Lion4K commented Jan 6, 2018

BS Launcher doesn't work either.

@Lion4K
Copy link
Author

Lion4K commented Jan 6, 2018

Both CrackLife and BlueShift reaches main menu, but does not load any maps. you keep clicking the example "hazard course" and doesn't do anything.

In BS Launcher I used the line -dev 3 -log -rodir /storage/F2ED-255F/xash and it did load the main menu blue background. but still not loading any maps.

@a1batross
Copy link
Member

a1batross commented Jan 7, 2018 via email

@Lion4K
Copy link
Author

Lion4K commented Jan 7, 2018

I didn't knew log as necessary, where is the log?

@Lion4K
Copy link
Author

Lion4K commented Jan 7, 2018

Is this the log?

https://pastebin.com/QGabXNPW

@a1batross
Copy link
Member

a1batross commented Jan 7, 2018 via email

@Lion4K
Copy link
Author

Lion4K commented Jan 7, 2018

dev 5 log
https://pastebin.com/5mzumGWj

@a1batross
Copy link
Member

a1batross commented Jan 7, 2018 via email

@Lion4K
Copy link
Author

Lion4K commented Jan 7, 2018

glad i could help somehow.

@a1batross
Copy link
Member

Was fixed in dd3580d.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants