Widget not updating on Android 15 - Stack Overflow

My app widgets stopped updating after updating compileSdk and targetSdkVersion to 35. AppWidgetProvider

My app widgets stopped updating after updating compileSdk and targetSdkVersion to 35. AppWidgetProvider method onUpdate is not called. I was searching for android 15 changes that could cause this but found none. When I put back targetSdkVersion 34 it updates on phones and emulators with android 14 but not on android 15. With both compileSdk and targetSdkVersion 34 it works fine.

abstract class BaseWidgetProvider : AppWidgetProvider(), KoinComponent {

companion object {
    const val WIDGET_NAME = "widget_name"
}

abstract fun getWidgetInfo(): Bundle

override fun onEnabled(context: Context?) {
    super.onEnabled(context)
    logFirebaseEvent(context!!, WIDGET_ADDED, getWidgetInfo())
}

override fun onDisabled(context: Context?) {
    super.onDisabled(context)
    logFirebaseEvent(context!!, WIDGET_REMOVED, getWidgetInfo())
}

override fun onUpdate(
    context: Context, appWidgetManager: AppWidgetManager,
    appWidgetIds: IntArray
) {
    Log.e("EEE", "onUpdate")
    updateWidgets(context)

}

}

This is my provider

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android=";
    android:initialLayout="@layout/widget_original_layout"
    android:configure="com.packagename.widget.WidgetSettingsActivity"
    android:minHeight="52dp"
    android:minWidth="160dp"
    android:resizeMode="horizontal|vertical"
    android:previewImage="@drawable/original_widget_preview"
    android:updatePeriodMillis="1800000" >

</appwidget-provider>

Of course it is declared in Manifest

<receiver
            android:name=".SunWidgetProvider"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.DATE_CHANGED" />
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/original_widget" />
        </receiver>

My app widgets stopped updating after updating compileSdk and targetSdkVersion to 35. AppWidgetProvider method onUpdate is not called. I was searching for android 15 changes that could cause this but found none. When I put back targetSdkVersion 34 it updates on phones and emulators with android 14 but not on android 15. With both compileSdk and targetSdkVersion 34 it works fine.

abstract class BaseWidgetProvider : AppWidgetProvider(), KoinComponent {

companion object {
    const val WIDGET_NAME = "widget_name"
}

abstract fun getWidgetInfo(): Bundle

override fun onEnabled(context: Context?) {
    super.onEnabled(context)
    logFirebaseEvent(context!!, WIDGET_ADDED, getWidgetInfo())
}

override fun onDisabled(context: Context?) {
    super.onDisabled(context)
    logFirebaseEvent(context!!, WIDGET_REMOVED, getWidgetInfo())
}

override fun onUpdate(
    context: Context, appWidgetManager: AppWidgetManager,
    appWidgetIds: IntArray
) {
    Log.e("EEE", "onUpdate")
    updateWidgets(context)

}

}

This is my provider

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android/apk/res/android"
    android:initialLayout="@layout/widget_original_layout"
    android:configure="com.packagename.widget.WidgetSettingsActivity"
    android:minHeight="52dp"
    android:minWidth="160dp"
    android:resizeMode="horizontal|vertical"
    android:previewImage="@drawable/original_widget_preview"
    android:updatePeriodMillis="1800000" >

</appwidget-provider>

Of course it is declared in Manifest

<receiver
            android:name=".SunWidgetProvider"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.DATE_CHANGED" />
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/original_widget" />
        </receiver>
Share asked Mar 14 at 14:57 user3407078user3407078 2132 silver badges7 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2
<receiver
            android:name=".SunWidgetProvider"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:exported="true">-------change here false to true

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744648798a4585776.html

相关推荐

  • Widget not updating on Android 15 - Stack Overflow

    My app widgets stopped updating after updating compileSdk and targetSdkVersion to 35. AppWidgetProvider

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信