如何通过点击我的应用程序的通知来锁定我的屏幕?
public void openNotification(View v) {
//This is to notification
Intent intent = new Intent();
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);
Notification noti = new Notification.Builder(this)
.setContentTitle("Easy Lock")
.addAction()
//.setActions()
.setAutoCancel(false)
.setOngoing(true)
.setContentText("Press Here to Lock Your Screen")
.setSmallIcon(R.drawable.logo)
.setContentIntent(pIntent).getNotification();
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, noti);