tauri-apps / plugins-workspace

All of the official Tauri plugins in one place!
https://tauri.app
Apache License 2.0
852 stars 237 forks source link

[barcode-scanner]Tauri : Waiting for the barcode module to be downloaded. Please wait. #836

Open xuchao-ovo opened 9 months ago

xuchao-ovo commented 9 months ago

Friends who love Rust and Tauri, I encountered problems while developing Android applications using Tauri and need help. When I use the barcode scanner plugin, I receive the following error message:

Tauri   : Waiting for the barcode module to be downloaded. Please wait.

Is there a problem with my usage? Here is how I use the barcode scanner plugin: In the file 'Cargo. toml':

[target."cfg(any(target_os = \"android\", target_os = \"ios\"))".dependencies]
tauri-plugin-barcode-scanner = "2.0.0-alpha.3"

In the file 'main.rs':

tauri::Builder::default()
        .plugin(tauri_plugin_window::init())
        .plugin(tauri_plugin_shell::init())
        .plugin(tauri_plugin_barcode_scanner::init())
        .invoke_handler(tauri::generate_handler![greet])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");

And it's written like this at the point of call:

if (state == "prompt") {
        requestPermissions();
      } else if (state == "denied") {
        return;
      } else if (state == "granted") {
        scan({
          windowed: false,
          formats: [Format.QRCode],
          //   cameraDirection: 'back'
        }).then((resp) => {
          console.log(`response: ${resp.content}`);
        });
      }

In addition, the device number of the camera will also prompt an error message. Is there a solution?

FabianLars commented 9 months ago

Does your device has a internet connection and Google Play Services? Currently the plugin dynamically downloads the module on the phone instead of the build system (to my understanding to reduce bundle size and share the module with other apps)

xsxz01 commented 9 months ago

So far, it is possible to download this module with the internet, and its functions are normal. However, the download conditions will be very difficult, and it cannot be downloaded every time. I guess it may be related to the internet in China.

Can this plugin provide an offline version or a way to integrate into the app?

songjiachao commented 2 months ago

same problem

songjiachao commented 2 weeks ago

Do You have a plain to support this?

FabianLars commented 2 weeks ago

Yes, otherwise this issue would be closed. I cannot give you an estimated timeframe though. I assume that this will not be part of the initial 2.0.0 release of the plugin (unless a community member wants to research and implement this).

xsxz01 commented 2 days ago

To solve this problem, it would be simpler if only the frontend is used. However, I'm not sure about using Rust. Do I need to create a frontend plugin to call the frontend?