I'm creating an Android Widget and are trying to receive the USER_PRESENT intent that I have registered in my AndroidManifest.xml. When the user unlocks their phone the widget should fetch and update itself with weather information I fetch from a backend. But i'm not receiving it on my Android 8 device. From what I read this is no longer supported?
I do it like this:
<receiver android:name=".AppWidgetProvider" android:label="@string/widget_name_4_2">
<intent-filter>
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/appwidget_info" />
</receiver>
And in my AppWidgetProvider
@Override
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent);
Log.w("log", "onReceive " + intent.getAction());
}
What is the alternatives to catch this intent? Foreground service? Something else? Is it even possible now days?