densen2014 / ZXingBlazor

Using ZXing Scan barcode/QR code in blazor
Apache License 2.0
93 stars 39 forks source link

Mobile Blazor Binding #2

Closed rajeshsws closed 3 years ago

rajeshsws commented 3 years ago

Hi Can we use this lib, for mobile blazor binding for android pro I am getting a below error on lenovo tablet 20201216_210455

Camera is not coming

densen2014 commented 3 years ago

Because Android or iOS can only use the native browser to have the permission to use the camera to obtain the stream scan barcode,it using h5 < video > label. And deployment to the Internet requires https.

your mobile blazor binding is deployment in local network or Internet ? or xamarin?

rajeshsws commented 3 years ago

Hi Densen Thnak you for quick response. Camera permission is already given , there is no permission issue. var status = await Permissions.CheckStatusAsync();

                if (status != PermissionStatus.Granted)
                {
                    status = await Permissions.RequestAsync<Permissions.Camera>();
                }
                if (status != PermissionStatus.Granted)
                {
                    return;
                }

also in Manifest.xml its given

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
<uses-permission android:name="android.permission.CAPTURE_SECURE_VIDEO_OUTPUT" />

I have tried on local same error is coming on ineternet is also coming same error. Do you have nay future plan for mobile blazor binding project to make it happen. There are lot of solution availabe but all thsoe are working for browser . Thank you

densen2014 commented 3 years ago

i never used blazor binding , can you sent me a little demo project for debug?

for me,if don't user in original browser,i choose xanarim form o uni-app for scan barcode

rajeshsws commented 3 years ago

Hi Though webapi I m getting data. When it run in Android emulator it do not work as well on internet. I tried both http client http and https. Once again thank you for your responses

On Thu, 17 Dec 2020, 14:01 alex chow, notifications@github.com wrote:

hi your blazor binding is run on android localhost or in a https website?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/densen2014/ZXingBlazor/issues/2#issuecomment-747292075, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALQCSD6D4EXJMTSAVOP2GWTSVG6URANCNFSM4UZJ53CQ .

densen2014 commented 3 years ago

so your h5/js codes is run in android local devices? blazor binding just named like blazor but not a blazor wasn neither blazor ssr right? when this js codes no run in browser original in android,it can't work ,because video label only works in browser,no works in webview control.

rajeshsws commented 3 years ago

Ok i got your points. Do you have any future plan to make it for webview.? Thank you

On Thu, 17 Dec 2020, 14:28 alex chow, notifications@github.com wrote:

so your h5/js codes is run in android local devices? blazor binding just named like blazor but not a blazor wasn neither blazor ssr right? when this js codes no run in browser original in android,it can't work ,because video label only works in browser,no works in webview control.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/densen2014/ZXingBlazor/issues/2#issuecomment-747305324, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALQCSD5RDSERADTSQMHJ33TSVHB3HANCNFSM4UZJ53CQ .

densen2014 commented 3 years ago

can you tell me how to run your blazor binding now?is webpage local or is a app like xamarin or something?

rajeshsws commented 3 years ago

Its like xamarin cross platform app.which run like xamarin. I will share you source code in my next email

On Thu, 17 Dec 2020, 14:47 alex chow, notifications@github.com wrote:

can you tell me how to run your blazor binding now?is webpage local or is a app like xamarin or something?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/densen2014/ZXingBlazor/issues/2#issuecomment-747315023, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALQCSDZGF5ZBS2JJE3X6WRLSVHECFANCNFSM4UZJ53CQ .

densen2014 commented 3 years ago

so maybe use xamarin essentials something cross image project better

densen2014 commented 3 years ago

like this

if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported) { await Application.Current.MainPage.DisplayAlert("没检测到摄像机或者无权限", "去开一下权限,或者只使用图库。", "打开权限", "只使用图库"); CrossPermissions.Current.OpenAppSettings(); return null; } var storageStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Storage); var cameraStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Camera);

        if (cameraStatus != PermissionStatus.Granted || storageStatus != PermissionStatus.Granted)
        {
            var results = await CrossPermissions.Current.RequestPermissionsAsync(new[] { Permission.Camera, Permission.Storage });
            cameraStatus = results[Permission.Camera];
            storageStatus = results[Permission.Storage];
        }
rajeshsws commented 3 years ago

Hi Alex Please download the source code and check what you do. https://wetransfer.com/downloads/cb7790750385f1601a8cbf5edc56756220201217094210/84313e https://wetransfer.com/downloads/cb7790750385f1601a8cbf5edc56756220201217094210/84313e Once again thank you for your prompt response Thank You

Best Regards Rajesh Shoky (9716000503) Methods Apparel Consultancy India Pvt Ltd. Vipul Business Park Suite :1016, 10th floor Sector 48 Gurugram-122001 Skype ID : shoky114 Linked In :LinkedIn.com/in/rajeshsheokand what's App :+919716000503

On Thu, Dec 17, 2020 at 3:04 PM alex chow notifications@github.com wrote:

like this

if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported) { await Application.Current.MainPage.DisplayAlert("没检测到摄像机或者无权限", "去开一下权限,或者只使用图库。", "打开权限", "只使用图库"); CrossPermissions.Current.OpenAppSettings(); return null; } var storageStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Storage); var cameraStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Camera);

    if (cameraStatus != PermissionStatus.Granted || storageStatus != PermissionStatus.Granted)

    {

        var results = await CrossPermissions.Current.RequestPermissionsAsync(new[] { Permission.Camera, Permission.Storage });

        cameraStatus = results[Permission.Camera];

        storageStatus = results[Permission.Storage];

    }

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/densen2014/ZXingBlazor/issues/2#issuecomment-747324075, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALQCSD5UPFVT4MC6RJEJQ4DSVHGA7ANCNFSM4UZJ53CQ .

rajeshsws commented 3 years ago

Hi Alex Where I need to Copy this code as i cna see in Xamarin, there is no such class Crossmedia and CrossPermission. var storageStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Storage); var cameraStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Camera); Thank you

densen2014 commented 3 years ago

Hi Alex Where I need to Copy this code as i cna see in Xamarin, there is no such class Crossmedia and CrossPermission. var storageStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Storage); var cameraStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Camera); Thank you

visit https://github.com/Redth/ZXing.Net.Mobile

rajeshsws commented 3 years ago

Hi Alex I have already tried this lib and it is working fine in Xamarin only project not in Mobile blazor binding.I am looking for Blazor Lib for Webview in Xamarin. Again a very big thanks for your response. If you make any MobileBlazorbinding project in future and use QR code please let me know Thank you

Best Regards Rajesh Shoky (9716000503) Methods Apparel Consultancy India Pvt Ltd. Vipul Business Park Suite :1016, 10th floor Sector 48 Gurugram-122001 Skype ID : shoky114 Linked In :LinkedIn.com/in/rajeshsheokand what's App :+919716000503

On Thu, Dec 17, 2020 at 4:22 PM alex chow notifications@github.com wrote:

Hi Alex Where I need to Copy this code as i cna see in Xamarin, there is no such class Crossmedia and CrossPermission. var storageStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Storage); var cameraStatus = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Camera); Thank you

visit https://github.com/Redth/ZXing.Net.Mobile

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/densen2014/ZXingBlazor/issues/2#issuecomment-747364983, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALQCSDYAXJSYTFO3WO63ZUTSVHPGPANCNFSM4UZJ53CQ .

rajeshsws commented 3 years ago

Hi My problem Solved. Camera is working in Mobile Blazor Binding with Zxing.mobile. ZXing.Mobile.MobileBarcodeScanner.Initialize(Application); in Main Activity.cs Thank you

densen2014 commented 3 years ago

嗨, 我的问题解决了。Camera正在使用Zxing.mobile在Mobile Blazor绑定中工作。 ZXing.Mobile.MobileBarcodeScanner.Initialize(Application); 在Main Activity.cs中 谢谢

is a good news!