'Android WhatsApp do voice call
I want to start voice call via WhatsApp from my application without entering WhatsApp chat window. Here's my code:
Uri mUri = Uri.parse("tel:" + getPhoneNumber(contactName, context));
Intent mIntent = new Intent(Intent.ACTION_CALL, mUri);
mIntent.setPackage("com.whatsapp");
mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(mIntent);
where getPhoneNumber(contactName, context) returns phone number as String. It works well for android.phone app, but not for whatsapp
Solution 1:[1]
Well there is a method to do the start call and capturing the event: state of call, and hangup event, and also a method to simulate voice from microphone, but this kind of project need a new whole of project customization and android modification.
the hint is do Java Reflection Method to initialize a Object/Class and invoke method to do the call,
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | nokideen |
