如何从Android中的可扩展通知发送回复? [英] How to send reply from expandable notification in android?

查看:93
本文介绍了如何从Android中的可扩展通知发送回复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请在下面的android gmail通知屏幕中找到,该屏幕具有存档和回复选项. 在按回覆而不是打开gmail应用时,应在通知区域中显示edittext,该区域将接受回覆文本 消息和回复消息应从通知本身发送. 我们怎样才能做到这一点? 按照下面的链接,我们可以显示针对存档和回复按钮的设置操作. http://developer.android.com/training/notify-user/expanded. html

Please find below android gmail notification screen which has option of archive and reply. On pressing reply instead of opening gmail app, the edittext should be displayed in notification area which will accept the reply text message and reply message should be sent from notification itself. How we can achive this ? As per the link below we can display set action to archive and reply buttons. http://developer.android.com/training/notify-user/expanded.html

// Sets up the archive and reply action buttons that will appear in the
// big view of the notification.

Intent archiveIntent = new Intent(this, ResultActivity.class);
archiveIntent.setAction(CommonConstants.ACTION_ARCHIVE);
PendingIntent piArchive = PendingIntent.getService(this, 0, archiveIntent, 0);

Intent replyIntent = new Intent(this, ResultActivity.class);
replyIntent.setAction(CommonConstants.ACTION_REPLY);
PendingIntent piReply = PendingIntent.getService(this, 0, replyIntent, 0);


NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_stat_notification)
.setContentTitle(getString(R.string.notification)) .setContentText(getString(R.string.ping))
.setDefaults(Notification.DEFAULT_ALL) 
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(msg))
.addAction (R.drawable.ic_stat_archive,getString(R.string.archive), piArchive)
.addAction (R.drawable.ic_stat_reply,getString(R.string.reply), piReply);

按回复按钮而不是转到gmail应用/打开整页ResultActivity 它应该在通知区域本身中显示指定高度,宽度和一个回复按钮的edittext. 如何做到这一点? 请提出可以采用哪种方法来实现这一目标. 预先感谢.

On pressing reply button instead of going to gmail app/ opening the full page ResultActivity it should display edittext of specified height , width and one reply button in notification area itself. How this can be achieved? Kindly suggest which approach can be followed in order to achieve this. Thanks in advance.

推荐答案

目前无法实现.您在此处指定了一组可能的通知类型: http://developer.android.com/guide/topics/ui/notifiers/notifications.html ,它们都不允许在通知抽屉中输入.您可以做的第二件事是让他们单击答复",并且仅可以打开必填字段的对话框(而不打开整个活动)

This is currently not possible. You have a set number of possible notification types as specified here: http://developer.android.com/guide/topics/ui/notifiers/notifications.html and none of them allow input in the notification drawer. The second best thing you can do is have them click reply and a dialog can open with only the required fields (and not open a whole activity)

这篇关于如何从Android中的可扩展通知发送回复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆