kwsch / PKHeX.Mobile

Pokémon save editor for Android and iOS!
Other
713 stars 358 forks source link

Exported save file is inaccessable #33

Closed eco9898 closed 2 years ago

eco9898 commented 2 years ago

Due to the latest version of Android, (android 11), android/data is no longer an easy access folder. Can I suggest changing the export function to just access a pkhex folder in the /storage/emulated/0/ folder instead. This would allow users to access the save file they export

kwsch commented 2 years ago

It already does that on the latest commit, and pipeline build.

eco9898 commented 2 years ago

Sorry, I thought I pulled the latest last night. Maybe I'm doing something wrong when I build causing it to use old code.

eco9898 commented 2 years ago

I'm going to try manually upgrading it for android 11 myself since it does appear to use the android 10 file permission system still. I'm just following this but probably gonna mess something up: https://stackoverflow.com/questions/31746787/xamarin-android-system-unauthorizedaccessexception-access-to-the-path-is-de

I haven't worked on android development before so I apologize if I have overlooked something.

eco9898 commented 2 years ago

I modified it to create a PkHex folder and to place the exported save into it. It uses android 11 permission: MANAGE_EXTERNAL_STORAGE I wasn't sure how to implement: private void RequestStorageAccess() { if (!Environment.IsExternalStorageManager) { StartActivityForResult(new Intent(Android.Provider.Settings.ActionManageAllFilesAccessPermission), 3); } } so I set up an error message prompting the user to enable the permission if it fails. By manually allowing the permission in the settings it works, although I have been told this is bad practice and there is a new file system API but I don't know how to go that step further. As this application is currently build and deploy yourself, rather than using the play store, I don't see the issues with using this permission for now.

I did try to set it up to create a sub folder with the date and time, but for some reason saving the file to this folder caused permission errors again

eco9898 commented 2 years ago

Finished with the android 11 permission upgrade. I created a fork and published it there. Also added a new feature to autoload the previously exported files.

eco9898 commented 2 years ago

Maybe allowing a separate android 11 branch would be good for people to choose if they need to?