From 53b4d24c5fa07d61668a43e248f8af4aab1276b3 Mon Sep 17 00:00:00 2001 From: bezloginu Date: Wed, 21 Jun 2017 22:48:21 +0200 Subject: [PATCH] Fix issue with phone number normalization --- app/build.gradle | 4 ++-- app/src/main/java/com/f1x/mtcdialer/DialActivity.java | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c8e0fd2..dc9e974 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,10 +5,10 @@ android { buildToolsVersion "24.0.1" defaultConfig { applicationId "com.f1x.mtcdialer" - minSdkVersion 19 + minSdkVersion 21 targetSdkVersion 25 versionCode 1 - versionName "1.2" + versionName "1.2.1" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/app/src/main/java/com/f1x/mtcdialer/DialActivity.java b/app/src/main/java/com/f1x/mtcdialer/DialActivity.java index cc5841e..f3ae690 100644 --- a/app/src/main/java/com/f1x/mtcdialer/DialActivity.java +++ b/app/src/main/java/com/f1x/mtcdialer/DialActivity.java @@ -4,6 +4,7 @@ import android.net.Uri; import android.os.Bundle; import android.os.RemoteException; +import android.telephony.PhoneNumberUtils; import android.widget.Toast; /** @@ -37,7 +38,7 @@ String extractPhoneNumber(Intent intent) { Uri uri = intent.getData(); if(uri != null && uri.getScheme().matches("tel|sms|smsto|mms|mmsto")) { - return uri.getSchemeSpecificPart().replaceAll("\\s+", ""); + return PhoneNumberUtils.normalizeNumber(uri.getSchemeSpecificPart()); } else { return null; }