Essentials: [Bug] [Android] PhoneDialer.Open() cause a strange "+" symbol in the Samsung Galaxy S8+

Created on 18 Mar 2020  路  11Comments  路  Source: xamarin/Essentials

Description

When using PhoneDialer.Open() to open the default phone dial-pad in the Samsung Galaxy S8+ (SM-G995W). It shows a strange "+" symbol between the digits.
For example, if you input a phone number string "8001234567", the dial-pad screen will show "800+1234567". Which should be "(800) 123-4567" on display.

On the Android emulator or some other android phones such as Samsung Note 4 it works properly.
However, when using the Samsung Galaxy S8+, the issue happens.

Samsung Galaxy S8+ info:
One UI version: 1.0
Android version: 9
Kernel version: 4.4.153-17895466

Steps to Reproduce

  1. Use Samsung Galaxy S8+
  2. Execute Xamarin. Essential method: PhoneDialer.Open("8001234567")
  3. The Samsung dial-pad shows "800+1234567"

Expected Behavior

Dial-pad should show "(800) 123-4567"

Actual Behavior

Dail-pad shows "800+1234567"

Basic Information

  • Version with issue: Android 9.0, Xamarin.Essentials 1.4.0/1.5.0/1.5.1 , Xamarin.Forms 4.5.0.356
  • Last known good version: Xamarin.Essentials 1.3.1
  • IDE: VS2019
  • Platform Target Frameworks:

    • Android: Android 9.0 Pie, API Level 28

  • Android Support Library Version:
  • Nuget Packages: Xamarin.Essentials 1.4.0/1.5.0/1.5.1 , Xamarin.Forms 4.5.0.356
  • Affected Devices: Samsung Galaxy S8+ and maybe some other Galaxy models
bug

All 11 comments

So, we have to run the phone number through the phone utils:

PhoneNumberUtils.FormatNumber(number, Java.Util.Locale.GetDefault(Java.Util.Locale.Category.Format).Country);

Are you able to run this code locally and see what happens on your device.

On my pixel 2 xl this works just fine with the formatting, so it could be an issue with the phone itself.

So, we have to run the phone number through the phone utils:

PhoneNumberUtils.FormatNumber(number, Java.Util.Locale.GetDefault(Java.Util.Locale.Category.Format).Country);

Are you able to run this code locally and see what happens on your device.

I ran the code in the "protected override void OnCreate(Bundle savedInstanceState)" function of the MainActivity.cs :
var phoneNumber = PhoneNumberUtils.FormatNumber("8001234567", java.Util.Locale.GetDefault(Java.Util.Locale.Category.Format).Country);
Console.WriteLine(phoneNumber);

And the log output:
03-18 06:40:08.027 I/mono-stdout(15145): (800) 123-4567

Meanwhile, when I am using "PhoneDialer.Open("8001234567");" in the Xamarin.Forms MainPage.xaml.cs at the same time:
It still gives me "800+1234567" in the Samsung S8 dail-pad.

The thing is when I am using Xamarin.Essentials v1.3.1 it works fine. (The device dial-pad shows properly)
However, when using the v1.4.0 the strange "+" starting to appear.

Therefore, there must something be changed in the Xamarin.Essentials between the v1.3.1 and
the v1.4.0 that causes this side effect.

I see this same behavior on a Galaxy Note9 on version 10 with the latest essentials 1.5.1. Maybe we have to pass a number formatted in E.164?

So, the only thing that was added was: https://github.com/xamarin/Essentials/issues/912

This was to fix extensions..

so after it calls Format number it does:

phoneNumber = URLEncoder.Encode(phoneNumber, "UTF-8");

I assume this is the issue.

This code probably only needs to be called if it contains , or ; which is an extension

Could you test doing : 8001234567,22 and tell me what happens there?

I wonder if this is a problem with samsungs dial pad? I am seeing pixel phones seem to work just fine

BTW - I tried adding a country code to my number and it works as expected.

If you want to test out this nuget: https://dev.azure.com/xamarin/public/_build/results?buildId=15530&view=artifacts&type=publishedArtifacts let me know if that works for you or not please.

If you want to test out this nuget: https://dev.azure.com/xamarin/public/_build/results?buildId=15530&view=artifacts&type=publishedArtifacts let me know if that works for you or not please.

I have tested this Xamarin.Essentials.1.4.0-preview1401 version and it works properly on my Samsung Galaxy G8 this time. Thank you very much.

Fixed in #1182

Was this page helpful?
0 / 5 - 0 ratings