Android Permission Denial: broadcasting Intent

androidandroid-widgetbroadcastreceiverpermission-denied

I really do not know what is wrong, but my if widget is update by system by "APPWIDGET_UPDATE" it throws following exception. I tried several things, exporting receiver (true/false), I tried it on emulators and real phones, but it is same. I added several intent-filters, but it did not work.

11-06 20:10:10.279: W/ActivityManager(61): Permission denied: checkComponentPermission() reqUid=1000
11-06 20:10:10.279: W/ActivityManager(61): Permission Denial: broadcasting Intent { act=android.appwidget.action.APPWIDGET_UPDATE (has extras) } from com.ency.easychange (pid=1196, uid=10034) requires null due to receiver com.android.settings/com.android.settings.widget.SettingsAppWidgetProvider

My AppWidgetProvider is only declared, because I tried to eliminate possibilities, but the exception is throw before ExchangeRateWidgetProvider.onReceive() is called.

public class ExchangeRateWidgetProvider extends AppWidgetProvider {
    public static final String tag = "ExchangeRateWidgetProvider"; 

        @Override
        public void onUpdate(Context context, AppWidgetManager appWidgetManager,
                int[] appWidgetIds) {

        }   
}

My Manifest:

<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="15" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

<!--  TODO: Remove, only for traces  -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

<application
    android:icon="@drawable/ic_launcher_main"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".EasyChange"
        android:label="@string/title_activity_easy_change" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


    <service android:name=".ExchangeRateWidgetService"
             android:exported="true">
        <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <action android:name="android.appwidget.action.APPWIDGET_ENABLED" />
        </intent-filter>        
    </service>


    <receiver
        android:name=".ExchangeRateWidgetProvider"
        android:label="@string/exchange_rate_widget_name"
        android:exported="true">
        <intent-filter>
            <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            <action android:name="android.intent.action.MAIN" />
        </intent-filter>

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

   <activity
        android:name=".WidgetConfigSmall"
        android:label="@string/title_activity_widget_config_small"
        android:theme="@android:style/Theme.Holo.Dialog"
        android:excludeFromRecents="true"
        android:exported="true" >
        <intent-filter>
            <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
        </intent-filter>
    </activity>

</application>

I appreciate if you can take a look …

Best Answer

Your problem lies somewhere in your Java code, where you are attempting to send the android.appwidget.action.APPWIDGET_UPDATE broadcast. That is to be broadcast by the OS, not by apps, and that is what the Permission Denial is about.