MauiSamples icon indicating copy to clipboard operation
MauiSamples copied to clipboard

IDialog wont work under Android

Open DeepWorksStudios opened this issue 2 years ago • 26 comments

it does not work (Save&Read) aswell it cant create a new folder or display right paths

DeepWorksStudios avatar Jun 20 '22 10:06 DeepWorksStudios

could you please provide more details?

VladislavAntonyuk avatar Jun 20 '22 11:06 VladislavAntonyuk

On the Exsample Project MauiPaint if you run it on Android you cant save or open the file

it does not trow any msg or similar. Its the stock project you can simply test it and see the result as well you cant create a folder and the paths does not exists

all under android windows seems fine

if you need any more information let me know i am highly intrested to solve that beacuse i dependt on a file picker

DeepWorksStudios avatar Jun 20 '22 11:06 DeepWorksStudios

Have you enabled the storage permission?

VladislavAntonyuk avatar Jun 20 '22 12:06 VladislavAntonyuk

Of course

DeepWorksStudios avatar Jun 20 '22 12:06 DeepWorksStudios

i checked promission on manifest image i checked promission on the phone aswell image Those paths doesn't exist even image See there the prove image

DeepWorksStudios avatar Jun 20 '22 13:06 DeepWorksStudios

it's the path to root. You can change it to your own path. https://github.com/VladislavAntonyuk/MauiSamples/blob/main/MauiPaint/Platforms/Android/Services/DialogService.cs#L38

VladislavAntonyuk avatar Jun 20 '22 13:06 VladislavAntonyuk

via replacing the null with my target path?

DeepWorksStudios avatar Jun 20 '22 14:06 DeepWorksStudios

Sry even the root path is invaild and i have no clu how to fix or change the path I need your help or i need to ditch your file picker and wirte my own from scracth wich would be a real boomer

DeepWorksStudios avatar Jun 20 '22 14:06 DeepWorksStudios

I will check tomorrow, but I suggest you to check what path you pass to the method.

Initial path is set here: https://github.com/VladislavAntonyuk/MauiSamples/blob/main/MauiPaint/Platforms/Android/Services/DialogService.cs#L38

VladislavAntonyuk avatar Jun 20 '22 18:06 VladislavAntonyuk

@DeepWorksStudios I can't reproduce it: On click Save: image

On click Open: image

VladislavAntonyuk avatar Jun 21 '22 12:06 VladislavAntonyuk

I will create a repo for reproducing the bug but it will take some time approxi next day Thanks for the support

DeepWorksStudios avatar Jun 21 '22 12:06 DeepWorksStudios

from what I see, you shared the screen from SDCard, the folders you see are the internal storage.

To see the folders you can open emulated/0/

maybe these links can help you as well:

  1. https://stackoverflow.com/questions/60569224/cant-write-to-android-external-storage-even-with-permissions-set/60594975#60594975
  2. https://o7planning.org/10541/android-external-storage

VladislavAntonyuk avatar Jun 21 '22 15:06 VladislavAntonyuk

I've just merged the branch which should fix your issue. please try again

VladislavAntonyuk avatar Jun 23 '22 12:06 VladislavAntonyuk

I have tested it extensively the mauipaint under different variations of android version and all under api level 30 will not work that is why it will not work on my project. Just drag the maui paint project add android emulator api level 23 that the minimun for the project to run and see the results. My personal device was api level 29 there the pictures come out but i observed every version had the same problems

can not save can not load and wrong paths

DeepWorksStudios avatar Jun 24 '22 16:06 DeepWorksStudios

If i may ask, could you reproduce it?

DeepWorksStudios avatar Jun 27 '22 06:06 DeepWorksStudios

I've just tried it on Android 6.0.1. And I see all my files: Screenshot_2022-06-27-12-27-41 Screenshot_2022-06-27-12-31-47 (1)

VladislavAntonyuk avatar Jun 27 '22 09:06 VladislavAntonyuk

Thats strange well than i will create a repoduction repo but it could take some time But i really appricate your help

DeepWorksStudios avatar Jun 27 '22 14:06 DeepWorksStudios

Could you please pull the latest changes? It contains fix for the Paint app

VladislavAntonyuk avatar Jun 27 '22 19:06 VladislavAntonyuk

I pulled your latest commit and it did not change the case sadly

The path exist not :/ i enabled invisable folders checked local storage external storage read/wirte promission

i really dont know what to do

https://user-images.githubusercontent.com/59297046/176146001-167351d0-de07-4e0f-a299-da831140eebf.mp4

DeepWorksStudios avatar Jun 28 '22 09:06 DeepWorksStudios

I had the same issue when I didn't provide permission to the storage for the app. Open App settings and make sure you allowed the access to the storage

VladislavAntonyuk avatar Jun 28 '22 10:06 VladislavAntonyuk

I did that already. Same result Screenshot_20220628-125717_Permission controller.jpg

DeepWorksStudios avatar Jun 28 '22 10:06 DeepWorksStudios

https://user-images.githubusercontent.com/33021114/176219389-36e6366b-d8fb-4c40-825f-b83fb2320546.mp4

VladislavAntonyuk avatar Jun 28 '22 15:06 VladislavAntonyuk

Its unmodified newest commit from you

https://user-images.githubusercontent.com/59297046/176236561-708f67d2-ff2a-4c36-9ee5-432c0c3d8f74.mp4

DeepWorksStudios avatar Jun 28 '22 16:06 DeepWorksStudios

Sorry, I don't know. By default the phone storage is "storage/emulated/0". You can try to traverse the file system to get the path you need.

VladislavAntonyuk avatar Jun 28 '22 19:06 VladislavAntonyuk

I added a check to make sure storage permission is granted. You can try to add android:requestLegacyExternalStorage="true" in your AndroidManifest.xml

VladislavAntonyuk avatar Jun 30 '22 11:06 VladislavAntonyuk

I will try that thanks :)

DeepWorksStudios avatar Jul 01 '22 05:07 DeepWorksStudios

I like the idea of the Dialogue service, but when I attempted to reuse your code to do this I keep getting a build error with MauiProgram.cs "CS0246 The type or namespace name 'DialogService' could not be found (are you missing a using directive or an assembly reference?)". Other than just using the code, is there a config setting to allow the serice to be seen and allow the build

Cairn23 avatar Aug 25 '22 08:08 Cairn23

Make sure you added it for all platforms

VladislavAntonyuk avatar Aug 25 '22 14:08 VladislavAntonyuk

It has been added to all platforms with the exception of Tizen, but I did not see this in your sample either. Is there a project setting that needs to be set so that the device type (Windows, Tizen etc) gets stripped out?

Cairn23 avatar Aug 26 '22 08:08 Cairn23

If you attach a small repro, I can help you

VladislavAntonyuk avatar Aug 26 '22 10:08 VladislavAntonyuk

First of all thank you very much for the offer of help.

I have removed a lot of the other code in order to just get to the problem.

Within MauiProgram.cs when ever I enable

builder.Services.AddSingleton<IDialogService, DialogService>();

the App will not build.

I have also has to mess with the FileDialog.cs withint he Android Platform services, but I think that is more a case of the incorrect set of usings.

Please find attached a zip of the code.

From: Vladislav Antonyuk @.> Sent: 26 August 2022 11:20 To: VladislavAntonyuk/MauiSamples @.> Cc: Cairn23 @.>; Comment @.> Subject: Re: [VladislavAntonyuk/MauiSamples] IDialog wont work under Android (Issue #24)

If you attach a small repro, I can help you

— Reply to this email directly, view it on GitHub https://github.com/VladislavAntonyuk/MauiSamples/issues/24#issuecomment-1228321240 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AFT5Z4XBONDRCPIHYXAL6NLV3CK3LANCNFSM5ZIP3ANQ . You are receiving this because you commented. https://github.com/notifications/beacon/AFT5Z4Q53ZX3DFO6YDPRFGTV3CK3LA5CNFSM5ZIP3AN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOJE3LDWA.gif Message ID: @.*** @.***> >

Cairn23 avatar Aug 28 '22 15:08 Cairn23

@Cairn23 Please attach the sample using GitHub. It is not attached when you send it using email

VladislavAntonyuk avatar Aug 28 '22 17:08 VladislavAntonyuk