I want to set phone number when I send message by hangout.
When I use sms, it can be done as below.
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setData(Uri.parse("sms:"));
sendIntent.putExtra("sms_body", message);
sendIntent.putExtra("adress", phoneNumber);
context.startActivity(sendIntent);
But I don't know how set phone number or target by phone number in hangout.. Here is my current code using hangout.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) //At least KitKat
{
String defaultSmsPackageName = Telephony.Sms.getDefaultSmsPackage(context);
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(Intent.EXTRA_TEXT, message);
if (defaultSmsPackageName != null)
{
sendIntent.setPackage(defaultSmsPackageName);
}
context.startActivity(sendIntent);
}
EDITED..!
I found solution from here. See the @Roberto B.'s solution.