I'm developing a dialer application that can be set as the default phone handler by the user.
In that case, if the user clicks on any phone number from a 3rd party app (say whatsapp), my application is being launched. But, how can I get the phone number that was clicked on by the user.
Try below code, I think it will help you:
Intent intent = new Intent(getContext(), SearchContact.class);
intent.setAction("android.intent.action.SEND");
Bundle a = new Bundle();
a.putSerializable("model", model);
intent.putExtra("model1", a);
startActivity(intent);
Found a solution to my problem. Below is the code.
String action = getIntent().getAction();
if ("android.intent.action.DIAL".equals(action) || "android.intent.action.VIEW".equals(action)) {
Uri data = intent.getData();
if (data != null) {
if ("tel".equals(data.getScheme())) {
this.etDialerNumber.setText(data.getSchemeSpecificPart());
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.