make sure we stop updates when we're supposed to
This commit is contained in:
parent
1268d8f6c7
commit
e9f46bd71d
|
@ -40,6 +40,18 @@ public class PlayerWidget extends AppWidgetProvider {
|
|||
startUpdate(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisabled(Context context) {
|
||||
super.onDisabled(context);
|
||||
stopUpdate(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleted(Context context, int[] appWidgetIds) {
|
||||
super.onDeleted(context, appWidgetIds);
|
||||
stopUpdate(context);
|
||||
}
|
||||
|
||||
private void startUpdate(Context context) {
|
||||
Log.d(TAG, "startUpdate() called with: " + "context = [" + context + "]");
|
||||
context.startService(new Intent(context, PlayerWidgetService.class));
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:resizeMode="none" android:initialLayout="@layout/player_widget" android:minHeight="40dp" android:minWidth="250dp">
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:resizeMode="none"
|
||||
android:initialLayout="@layout/player_widget"
|
||||
android:updatePeriodMillis="600000"
|
||||
android:minHeight="40dp"
|
||||
android:minWidth="250dp">
|
||||
|
||||
</appwidget-provider>
|
Loading…
Reference in New Issue