android - 在后台自动回复 WhatsApp 消息

标签 android android-notifications whatsapp accessibilityservice

我刚刚检查了 Application , 正在后台自动回复 WhatsApp 消息。我也在尝试这样做,但无法获得成功。 我试过:

 Intent sendIntent = new Intent();
 sendIntent.setAction(Intent.ACTION_SEND);
 sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
 sendIntent.setType("text/plain");
 sendIntent.setPackage("com.whatsapp");
 startActivity(sendIntent);

但是它打开了 WhatsApp 应用程序 :(,没有发送消息。

我浏览了几个链接:Question1 , Question2还有article但没有得到满意的答复。

application正在访问通知以获取消息并回复它,我还尝试使用 NotificationListenerService 读取通知,并成功读取消息:),但无法发送回复,我想知道他们如何在不打开应用程序的情况下在后台发送消息

最佳答案

我还没有测试过这个,但我认为这可以通过 Read Notification Bar title, message using Accessibility Service Programmatically

https://developer.android.com/reference/android/app/RemoteInput

来自文档:

 public static final String KEY_QUICK_REPLY_TEXT = "quick_reply";
 Notification.Action action = new Notification.Action.Builder(
         R.drawable.reply, "Reply", actionIntent)
         .addRemoteInput(new RemoteInput.Builder(KEY_QUICK_REPLY_TEXT)
                 .setLabel("Quick reply").build())
         .build();

关于android - 在后台自动回复 WhatsApp 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50815024/

相关文章:

android - 在 Android 上禁用窗口调整大小动画

android - Firebase v1 HTTP api 不支持嵌套的 JSON 对象

javascript - 使用 html 或 jquery 或 javascript 在 Whatsapp 中发送图片

c# - 从 C# 发送 WhatsApp 消息

java - 在 onRegistered 和 onUnregistered 方法中从 GCMIntentService 更新 TextView

Android如何创建弹出窗口

Wear 设备上的 Android 通知。 `localOnly` 标志

html - 还可以在带有图片标签的 whatsapp 上分享网站链接

android - 在计算机上调整文本大小但在手机 HTML 上不调整

android - 通知图标变灰