我的代码有效,但是是否有一个命令可以在没有用户确认的情况下真正发送 whatsapp 消息?
My code works, but is there a command to really send a whatsapp message without user confirmation?
我正在开发一个 phone 应用程序并具有向特定 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);
}
问题是它只是打开聊天并写下“;)”,但实际上并没有发送。我已经阅读了几个小时,我想知道是否有一种方法可以使它自动化。
如果您知道一些代码可以完成我正在谈论的事情,那将是非常受欢迎的 ;)
嗯,目前是不可能的。有人说这将是一个相当大的安全漏洞,所以这似乎是有道理的
(无论如何,发送自动短信很容易:P)
我正在开发一个 phone 应用程序并具有向特定 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);
}
问题是它只是打开聊天并写下“;)”,但实际上并没有发送。我已经阅读了几个小时,我想知道是否有一种方法可以使它自动化。 如果您知道一些代码可以完成我正在谈论的事情,那将是非常受欢迎的 ;)
嗯,目前是不可能的。有人说这将是一个相当大的安全漏洞,所以这似乎是有道理的
(无论如何,发送自动短信很容易:P)