mirror of
https://gitlab.com/oeffi/oeffi.git
synced 2025-07-06 17:38:48 +00:00
NearestFavoriteStationWidgetProvider: immediately refresh app-widget on boot complete
It takes annoyingly long for the regular app-widget update broadcast to arrive.
This commit is contained in:
parent
bb4ce986e0
commit
996a89a133
2 changed files with 20 additions and 0 deletions
|
@ -34,6 +34,7 @@
|
|||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
||||
|
||||
<uses-feature
|
||||
|
@ -244,6 +245,9 @@
|
|||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/nearest_favorite_station_widget" />
|
||||
|
|
|
@ -21,8 +21,24 @@ import android.appwidget.AppWidgetManager;
|
|||
import android.appwidget.AppWidgetProvider;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class NearestFavoriteStationWidgetProvider extends AppWidgetProvider {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(NearestFavoriteStationWidgetProvider.class);
|
||||
|
||||
@Override
|
||||
public void onReceive(final Context context, final Intent intent) {
|
||||
final String action = intent.getAction();
|
||||
log.info("got broadcast: {}", action);
|
||||
|
||||
if (Intent.ACTION_BOOT_COMPLETED.equals(action))
|
||||
NearestFavoriteStationWidgetService.enqueueWork(context, new Intent());
|
||||
else
|
||||
super.onReceive(context, intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(final Context context, final AppWidgetManager appWidgetManager, final int[] appWidgetIds) {
|
||||
NearestFavoriteStationWidgetService.enqueueWork(context, new Intent());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue