How can I display the activity when device is locked?
<p>I want to display one Activity Android, also when I lock my device.
Every Time, if I lock my tablet (for example), I should to see one Activity.</p>

<p>So, I have built this in AndroidManifest.xml:</p>

<pre><code>&lt;activity
    android:name=".activity.SetupInfoEmergencyActivity"
    android:label="@string/app_name"
    android:showOnLockScreen="true"
    android:screenOrientation="sensorPortrait"&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;
</code></pre>

<p>This is the code of activity</p>

<pre><code>public class SetupInfoEmergencyActivity extends AppCompatActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {

        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
                WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
                WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.settings_activity);
    }

}
</code></pre>

<p>Now, if I try to run debug, I can see this activity, but if I un-lock my device, and I lock the device I can't see the activity.</p>