在后台自动回复WhatsApp消息 [英] Auto Reply to WhatsApp message in background
本文介绍了在后台自动回复WhatsApp消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚签出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
阅读通知,并成功读取了Message:),但无法发送回复,我想知道他们如何在不打开应用程序的情况下在后台发送消息。
推荐答案
我还没有测试过,但我认为可以通过 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();
这篇关于在后台自动回复WhatsApp消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文