Flutter url_launcher with multiple phone numbers

435

This should be done programmatically on flutter side, i.e. you should create popup dialog or widget, and on telephone tap open it. Then, inside popup show buttons for each number with url_launcher calls. It will be much more configurable, than something fixed inside the plugin.

Share:
435
albero123
Author by

albero123

Updated on December 28, 2022

Comments

  • albero123
    albero123 over 1 year

    I am developing an app on Flutter for both Android and iOS platform.

    I have two contact numbers. I would like that the user, when clicking on one of them, gets to choose which to call. For example, in iOS it should open the action sheet with both possibilities (e.g. as it happens when clicking on an activity with multiple contacts through Google search).

    Currently, I'm using Flutter 2.0.1 and url_launcher 6.0.2.

    The method launch(url) works fine in both platforms if I put in the url a single number (e.g. "tel:123456").

    How can I format the url in order to contain two (or more) numbers?

    I tried to insert more numbers with some divider chars, e.g "tel:123456,654321", but it didn't work.

    Thank you all.

    • FDuhen
      FDuhen about 3 years
      Hello, I don't really understand your need here. The point of url_launcher with the tel parameter is to trigger a phone call, how would you like your phone app to behave with two phone numbers ?
    • albero123
      albero123 about 3 years
      Hi there! The user should click on one button and then decide what to call. Tbh, I have an iPhone, I’m used to see action sheets with multiple options, I don’t know if in android it’s the same. I think I’ll invent something as the first comment suggests.
  • albero123
    albero123 about 3 years
    Hey thanks for the answer! I thought this was something easy (just a unknown way to format the url), but I will probably do what you suggest, I already have something in mind. I will keep the question open a little bit more just to be sure and then mark your answer as the best.