0

I make an app that like android dialer. I need to show my app on "open with" list when someone click on number on android (like default dialer or get contact), and how to get the number clicked and put it on textview on my app..?

Im sorry if there was a same question, but i tried to find the sollution then still nothing.

ardan7779
  • 318
  • 3
  • 8
  • There are many questions https://stackoverflow.com/a/5029367/1133011, https://stackoverflow.com/a/10303212/1133011 and https://stackoverflow.com/a/58433232/1133011 – David Kroukamp Nov 25 '20 at 14:06
  • Thanks @DavidKroukamp ! but I didn't find how to get the number clicked by user and put it in my own app. How to do that..? – ardan7779 Nov 25 '20 at 14:41
  • That's the part where you add the intent to your manifest declaration. Then the user will be prompted which app they want to use, yours or the inbuilt dialer, unless they have set a default then it wont prompt you need to choose yours as default – David Kroukamp Nov 25 '20 at 15:29
  • I could set my app appears in open with. But I didn't get the solution how to get the number clicked before and show it on my own app. – ardan7779 Nov 25 '20 at 15:57

1 Answers1

0

I know it's a bit late to answer, but, in case somebody else is looking for the short answer, this code worked for me:

Intent intent = getIntent();
Uri returnUri = intent.getData();
String phoneNumber = returnUri.toString().replace("%20", "").replace("tel:","");
Log.i("PHONE_NUMBER",  phoneNumber);
Miguel
  • 188
  • 5