Getting SecurityException when trying to install appWidget in HomeScreen
am having a little trouble here. i don't know why i am getting a SecurityException, when trying to install my AppWidget on the home screen?. i don't know what will help to solve this but here is the simplified logcat output and my Android Manifest for starters:
11-30 18:02:16.454: ERROR/AndroidRuntime(287): Caused by: java.lang.SecurityException: Permission Denial: starting Intent { act=android.appwidget.action.APPWI开发者_JS百科DGET_CONFIGURE cmp=com.MuchachaApps.WeatherViewer/.WeatherForecastConfigure (has extras) } from ProcessRecord{44e58dc8 287:android.process.acore/10001} (pid=287, uid=10001) requires null
11-30 18:02:16.454: ERROR/AndroidRuntime(287):atandroid.os.Parcel.readException(Parcel.java:1218)
113018:02:16.454:ERROR/AndroidRuntime(287):atandroid.os.Parcel.readException(Parcel.java:1206)
113018:02:16.454:ERROR/AndroidRuntime(287):atandroid.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1214)
113018:02:16.454:ERROR/AndroidRuntime(287):atandroid.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
113018:02:16.454:ERROR/AndroidRuntime(287):atandroid.app.Activity.startActivityForResult(Activity.java:2749)
113018:02:16.454:ERROR/AndroidRuntime(287):atcom.android.launcher.Launcher.startActivityForResult(Launcher.java:969)
113018:02:16.454:ERROR/AndroidRuntime(287):atcom.android.launcher.Launcher.addAppWidget(Launcher.java:1148)
113018:02:16.454:ERROR/AndroidRuntime(287):atcom.android.launcher.Launcher.onActivityResult(Launcher.java:379)
113018:02:16.454:ERROR/AndroidRuntime(287):atandroid.app.Activity.dispatchActivityResult(Activity.java:3828)
113018:02:16.454:ERROR/AndroidRuntime(287):atandroid.app.ActivityThread.deliverResults(ActivityThread.java:3325)
11-30 18:02:16.454: ERROR/AndroidRuntime(287):... 11 more
My Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.MuchaaApps.WeatherViewer"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<service android:name= "weatherForecast"></service>
<activity android:name=".WeatherForecastConfigure" android:label="@string/app_name"></activity>
<receiver android:name="WeatherWidgetProvider" android:label="Weather Forecast">
<intent-filter>
<action android:name= "android.appwidget.action.APPWIDGET_UPDATE"></action>
</intent-filter>
<intent-filter>
<action android:name="com.MuchaaApps.WeatherViewer.WEATHER_UPDATE"></action>
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/weather_appwidget_info"></meta-data>
</receiver>
</application>
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
if you need any other information, please let me know. Thank you
Do you have a configuration Activity that's supposed to come up when you add the widget to the launcher? If so, you need to add an APPWIDGET_CONFIGURE
action to your intent-filter. If not, you need to remove the android:configure
attribute from your appwidget-provider XML.
Having one but not the other is the problem.
精彩评论