title: Prompt to unlock lock screen on custom notification click
body: <p>I have a custom notification shown in the lock screen. I am using a broadcast pending intent to send a message to my app once the notification is clicked. Which later starts an activity in the broadcast receiver.</p>
  
  <p>The problem is, once I click on the notification, it disappears from the lock-screen and the activity is launched behind the lock-screen. It does not ask the user to unlock the screen.</p>
  
  <p>My requirement is to ask the user to unlock the screen as soon as the broadcast is sent by the notification's click event. How do I do that?</p>
  
  <p>I could find <a href="https://stackoverflow.com/questions/34980389/how-to-open-ask-for-lock-screen-after-double-click-on-notification-android">this</a> question which looks like my problem. But unfortunately there is no answer.</p>
  
  <p>Here is some code that explains the notification creation I did.</p>
  
  <pre><code>/**
   * Method to render Notification
   */
  private void showNotification() {
      NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
      /* set mandatory stuff on builder */
  
      Notification notification = builder.build();
      if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.JELLY_BEAN) {
          notification.bigContentView = createCustomView(context);
      }
  
      NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
      manager.notify(getNotificationId(), notification);
  }
  
  /**
   * Method to return notification click's PendingIntent
   */
  private PendingIntent getNotificationClickIntent() {
      Intent bcIntent = new Intent(OPEN_APP);
      bcIntent.putExtra(EXTRA_DEEP_LINK_URL, getDeepLinkUrl());
  
      return PendingIntent.getBroadcast(
          context, getReqCode(), bcIntent, PendingIntent.FLAG_ONE_SHOT);
  }
  
  /**
   * Method to create custom view for notification
   */
  private RemoteViews createCustomView(Context context) {
     RemoteViews customView = new RemoteViews(context.getPackageName(), R.layout.custom_layout);
  
     if (customView != null) {
          // set dat on views
  
          customView.setOnClickPendingIntent(R.id.my_view, getNotificationClickIntent());
     }
  
     return customView;
  }
  </code></pre>