我的应用程序提供了一个小部件。用户可以将小部件添加到他的 Android 操作系统的主屏幕。当用户点击小部件时,我的应用程序就会打开。
问题是:运行时,该应用程序未显示在“最近的应用程序”列表中。
无论它是如何打开的,如何让我的应用程序显示在“最近使用的应用程序”列表中?
这是用于打开应用程序的意图:
Intent intent = new Intent(context, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
views.setOnClickPendingIntent(R.id.widget_contents, pendingIntent);
这是应用程序清单中的活动声明:
<activity
android:name=".MainActivity"
android:label="@string/title_activity_browse_playlist"
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden"
android:launchMode="singleTop">
</activity>