I'm developing a phone application and have this function to send an automatic wink (;)) to a specific phone number/contact:
public void onClickWhatsApp(View view) {
PackageManager pm=getPackageManager();
String mensajillo = ";)";
String toNumber = "xxxxxxxxxxx"; //The xs are replaced with the number which I obtain from other function, but that doesn't matter here
Intent sendIntent = new Intent(Intent.ACTION_SENDTO,Uri.parse("smsto:" + "" + toNumber + "?body=" + ""));
sendIntent.setPackage("com.whatsapp");
startActivity(sendIntent);
Intent texintent = new Intent(Intent.ACTION_VIEW);
texintent.setData(Uri.parse("http://api.whatsapp.com/send?phone="+toNumber +"&text="+mensajillo));
startActivity(texintent);
}
The thing is that it's just opening the chat and writing the ";)", but not actually sending it. I've been reading for hours and I'm if there's even a way to automatize that. If you know some code that could do what I'm talking about, it would be very welcome ;)