Marogian
Marogian

Reputation: 503

Manifest file not giving permissions as it should. Permission denied when they're given in Manifest

I'm trying to make a ticker widget for BBC News, most of it was working perfectly well last night, but I had a few issues getting the permissions for the configuration activity correct. After re-writing my Manifest nothing works at all, despite being completely how it should be as far as I can tell.

Here's my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.news.bbcwidget"
    android:versionCode="1"
    android:versionName="101">

    <application
        android:label="@string/app_name"
        android:icon="@drawable/logo"
        android:permission="android.permission.INTERNET"
        android:persistent="true"
        android:debuggable="true"
        android:enabled="true">

        <activity
            android:name="BBCWidgetConfig"
            android:permission="android.permission.INTERNET">

            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
            </intent-filter>
        </activity>

        <activity
            android:name="Launcher"
            android:permission="android.permission.INTERNET" />

        <receiver
            android:name="BBCNewsWidget"
            android:permission="android.permission.INTERNET">

            <service
                android:permission="android.permission.INTERNET"
                android:name="BBCNewsService" />

            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>

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

        </receiver>

        <service android:name="BBCNewsWidget$BBCNewsService" />

    </application>

</manifest> 

and here are the key bits of the errors received:

06-19 20:06:34.339: WARN/ActivityManager(58): Permission Denial: Accessing service ComponentInfo{com.news.bbcwidget/com.news.bbcwidget.BBCNewsWidget$BBCNewsService} from pid=58, uid=1000 requires android.permission.INTERNET
06-19 20:06:34.529: ERROR/AndroidRuntime(247): java.lang.RuntimeException: Unable to start receiver com.news.bbcwidget.BBCNewsWidget: java.lang.SecurityException: Not allowed to start service Intent { cmp=com.news.bbcwidget/.BBCNewsWidget$BBCNewsService } without permission android.permission.INTERNET
06-19 20:06:34.529: ERROR/AndroidRuntime(247): Caused by: java.lang.SecurityException: Not allowed to start service Intent { cmp=com.news.bbcwidget/.BBCNewsWidget$BBCNewsService } without permission android.permission.INTERNET
06-19 20:10:51.558: WARN/ActivityManager(58): Permission Denial: broadcasting Intent { act=android.appwidget.action.APPWIDGET_DELETED cmp=com.news.bbcwidget/.BBCNewsWidget (has extras) } from android (pid=113, uid=10000) requires android.permission.INTERNET due to receiver com.news.bbcwidget/com.news.bbcwidget.BBCNewsWidget
06-19 20:10:51.558: WARN/ActivityManager(58): Permission Denial: broadcasting Intent { act=android.appwidget.action.APPWIDGET_DISABLED cmp=com.news.bbcwidget/.BBCNewsWidget } from android (pid=113, uid=10000) requires android.permission.INTERNET due to receiver com.news.bbcwidget/com.news.bbcwidget.BBCNewsWidget

It was previously giving "bad process" errors but that seems to have stopped now. From what I understand the Manifest is giving android.permission.INTERNET to all of my services, activities and the AppWidgetProvider, so I don't understand why this is happening. it used to work before!

Cheers!

Upvotes: 0

Views: 5694

Answers (1)

Pentium10
Pentium10

Reputation: 207912

Add

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

To your manifest node and not to the activities

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.news.bbcwidget"
      android:versionCode="1"
      android:versionName="101">
<application 
....
</application>
<uses-permission
        android:name="android.permission.INTERNET"></uses-permission>
</manifest> 

Upvotes: 6

Related Questions