Copy paste via notification bar in Android

送分小仙女□ 提交于 2019-12-11 09:38:41

问题


Have you seen these password managers like Lastpass ? They allow you to copy-paste via Notification bar in Android. Typically, the sequence is like this..

  1. User in Lastpass presses a button, that puts two notifications in Notification Bar.
  2. User switches to any other application say a browser and when he has to insert username and password
  3. He opens notification bar, selecting the notifications from Lastpass pastes the username or password into the textfield of the browser.

Can anyone break this down into steps and guide me how I can implement this kind of a structure...

Thanks


回答1:


Step #1: Raise a Notification, with a getBroadcast() PendingIntent pointing to a BroadcastReceiver of yours.

Step #2: In that BroadcastReceiver, copy the data to the clipboard using ClipboardManager.



来源:https://stackoverflow.com/questions/12596482/copy-paste-via-notification-bar-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!