How do I adapt-migrate my existing Xamarin Forms code project code to Blazor WebView project? #24548
Unanswered
soykanozcelik
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
I’ve Xamarin Forms project(s) which is using WebView (within aspnet webforms) and working well all but last project is different because it’s using web camera and location for qrcode reading via zxing js library codes. Related page running well with desktop or mobile browser w/o problem.
But when I run my web project under Xamarin project via WebView it’s working but something is blocking camera and location access :/
What is my goal?
If its possible want to fix my project with some touches-modifies with you help its will be very appreciated
If its not possible or if necessary current technologies and are easy and updatedle for future and versions, which is maui app or Andriod+iOS blazor webview app can solve my need and how can I easily migrate it to with my current structure and codes?
I want to explain my project workflow as you will see below codes
Actually my project is very simple and I have 2 xaml file main.xaml and mainpage.xaml, when main page (main.xaml) executing at first load searching a value which is created Xamarin Essentials plugin Preferences.
Eg. Prefences.Get(“myValue”); if myValue is not exist or null one of an entry field and an button appearing and ask “please enter your firm nickname” to user, after user clicked save button this value is saving via Prefences.Set(“myValue”,txtNickName,Text) and then setting webview source property like below
That’s it and all of process is running on related web site within webview. Xamarin forms project mission that's it and so simple.
If I should summarize, only problem is camera and location permissions not accepting by webview even if it’s already set in AndroidManifest file.
So I want to share my codes for easily understanding
Here is my codes main.xaml.cs and mainPage.xaml.cs
PS-1 : I’ve set related permissions at AndroidManifest file
PS-2 : I’ve tried some suggestions about permission requests, custom renderers etc. but I couldn’t success :/ may be you can update my codes
PS-3 : I saw a Permission Plugin which is author @jamesmontemagno James Montemagno at this address https://github.com/jamesmontemagno/PermissionsPlugin?tab=readme-ov-file. I doubt if it solve my problem so that with the newest maui version specially Blazor webview solution is will be the best when i success to migrate my existing codes with your helps
PS-4 : you’ll find full project and related jscodes text file which is attached
Thanks a lot from now for your valuable helps.
@jamesmontemagno @jfversluis @davidortinau
CozbimPermobil.zip
jsCodes.txt
Beta Was this translation helpful? Give feedback.
All reactions