简体   繁体   中英

How to open Viber app in Flutter web app?

I want to open Viber app (Android / Windows) from flutter web application. I tried using url_launcher but it does not work.

The URL to open Viber chat is viber://chat?number=xxx . How can I call this from flutter web app?

Found a solution. I used html package

import 'dart:html' as html;

After that

html.window.open('viber://chat?number=xxx', '');

你可以试试这个包Flutter AppAvailability Plugin

Searching for the same solution but only for a mobile app, Google gives me only this question. So, I decided to write the research results here. Maybe it will come in handy.

For a mobile app, you can use url_launcher

launch('viber://chat?number=$phoneNumber');

If you want to open the conversation with a predefined text, you can write like this:

launch('viber://chat/?number=$phoneNumber&draft=$yourMessage');

Please note, if Viber is not installed on your device, the launch method throws an error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM