title: Notification with setFullScreenIntent not displaying activity when screen is off
body: <p>I have been trying to show an activity in my app when a notification is triggered and the device screen is off. This activity is a screen for handling an incoming call.</p>
  
  <p>So far, this is working with an Android Nougat (Huawei P9 lite) device, but not working with my Android Pie device (Samsung Galaxy A20).</p>
  
  <p>Due to the complexity of my app, I am trying to reproduce this with a simpler project.</p>
  
  <p>So I am using the this <a href="https://github.com/commonsguy/cw-omnibus/tree/FINAL/Notifications/FullScreen" rel="nofollow noreferrer">project</a> that as far as I understand, should do what I want.</p>
  
  <p>However with this code, the activity is not displayed when the app start and if the screen is off. The notification is added to the notification area.</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>public class MainActivity extends Activity {
    private static final String CHANNEL_WHATEVER="channel_whatever";
    private static final int NOTIFY_ID=1337;
  
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      NotificationManager mgr=
          (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
  
      if (Build.VERSION.SDK_INT&gt;=Build.VERSION_CODES.O &amp;&amp;
        mgr.getNotificationChannel(CHANNEL_WHATEVER)==null) {
        mgr.createNotificationChannel(new NotificationChannel(CHANNEL_WHATEVER,
          "Whatever", NotificationManager.IMPORTANCE_DEFAULT));
      }
  
      mgr.notify(NOTIFY_ID, buildNormal().build());
  
      finish();
    }
  
    private NotificationCompat.Builder buildNormal() {
      NotificationCompat.Builder b=
        new NotificationCompat.Builder(this, CHANNEL_WHATEVER);
  
      b.setAutoCancel(true)
       .setDefaults(Notification.DEFAULT_ALL)
       .setContentTitle(getString(R.string.download_complete))
       .setContentText(getString(R.string.fun))
       .setContentIntent(buildPendingIntent(Settings.ACTION_SECURITY_SETTINGS))
       .setSmallIcon(android.R.drawable.stat_sys_download_done)
        .setNumber(5)
       .setFullScreenIntent(buildPendingIntent(Settings.ACTION_DATE_SETTINGS), true)
       .addAction(android.R.drawable.ic_media_play,
           getString(R.string.play),
           buildPendingIntent(Settings.ACTION_SETTINGS));
  
      return(b);
    }
  
    private PendingIntent buildPendingIntent(String action) {
      Intent i=new Intent(action);
  
      return(PendingIntent.getActivity(this, 0, i, 0));
    }
  }
  </code></pre>
  
  <p><strong>AndroidManifest.xml</strong></p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.commonsware.android.fullscreen"
  android:versionCode="1"
  android:versionName="1.0"&gt;
  
  &lt;uses-sdk
      android:minSdkVersion="14"
      android:targetSdkVersion="15"/&gt;
  &lt;supports-screens android:largeScreens="true" android:smallScreens="true" android:normalScreens="true" android:xlargeScreens="true"/&gt;
  &lt;uses-permission android:name="android.permission.VIBRATE"/&gt;
  
  &lt;application
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name"&gt;
      &lt;activity
          android:name="MainActivity"
          android:theme="@android:style/Theme.Translucent.NoTitleBar"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN"/&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>I tested this in the following physical devices:</p>
  
  <ul>
  <li>Android Nougat (Huawei P9 lite) </li>
  <li>Android Pie device (Samsung Galaxy A20)</li>
  <li>Android Marshmallow (Samsung Galaxy Tab)</li>
  </ul>
  
  <p>I have read <a href="https://developer.android.com/training/notify-user/time-sensitive" rel="nofollow noreferrer">this documentation</a> and I know that in Android 10 there are <a href="https://developer.android.com/guide/components/activities/background-starts" rel="nofollow noreferrer">some limitations</a> and <a href="https://developer.android.com/about/versions/10/behavior-changes-10#full-screen-intents" rel="nofollow noreferrer">a solution</a> but for now I am only focusing on Android Pie and below. Of course then the solution will also need to work on Android 10.</p>
  
  <p>Am I missing something? I would like to make this example work for all Android versions so that I can apply the solution to my own app.</p>
  
  <p>Any help would be greatly appreciated.</p>