The application does not appear in the list of recent applications when opened via PendingIntent

My application offers a widget. A user can add a widget to the home screen of their Android OS. When the user uninstalls the widget, my application opens.

Problem: at startup, the application does not appear in the list of recent applications.

How can I make my application appear in the list of recent applications, no matter how it was opened?

Here is what we used to open the application:

Intent intent = new Intent(context, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
views.setOnClickPendingIntent(R.id.widget_contents, pendingIntent);

Here is the activity declaration in the application manifest:

<activity
    android:name=".MainActivity"
    android:label="@string/title_activity_browse_playlist"
    android:screenOrientation="portrait"
    android:configChanges="orientation|keyboardHidden"
    android:launchMode="singleTop">
</activity>
+4
source share

Source: https://habr.com/ru/post/1528912/


All Articles