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
Dial-pad should show "(800) 123-4567"
Dail-pad shows "800+1234567"
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