Roc*_*cky 5 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);
Run Code Online (Sandbox Code Playgroud)
但是它打开WhatsApp应用程序:(,不发送消息。
我浏览了几个链接:Question1,Question2也对此发表了文章,但没有得到满意的答案。
该应用程序正在访问的通知来获得消息,并回答了,我也尝试过使用阅读通知NotificationListenerService,并获得成功读取消息:),但不能发送回复它,我想知道他们是如何发送消息在后台而不打开应用程序。
我还没有对此进行测试,但我认为这可以通过 以编程方式使用辅助功能服务读取通知栏标题、消息来完成
和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();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1678 次 |
| 最近记录: |