Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android StackWidget unable to bind

I am currently trying to add a widget to my application and have been basing my implementation on this code http://developer.android.com/resources/samples/StackWidget/index.html

I have put all my stack widget related classes in their own package within my main package.Package setyp

When I try to add the widget it is unable to bind and hence the cards are not displayed (it just states the default text "This is the empty view")

Below is my manifest.

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

    <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="14" />

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

    <application android:icon="@drawable/ic_launcher"
        android:logo="@drawable/logo" android:theme="@style/DealPadTheme"
        android:hardwareAccelerated="true" android:uiOptions="splitActionBarWhenNarrow">
        <activity android:label="@string/app_name" android:name=".DealPadActivity"
            android:configChanges="keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".SettingsActivity" />
        <activity android:name="com.google.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />


        <!-- Widgets -->
        <receiver android:name=".stackwidget.StackWidgetProvider">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            </intent-filter>
            <meta-data android:name="android.appwidget.provider"
                android:resource="@xml/stackwidgetinfo" />
        </receiver>

        <service android:name="stackwidget.StackWidgetService"
            android:permission="android.permission.BIND_REMOTEVIEWS"
            android:exported="false" />


    </application>

</manifest>

Error message:

E/RemoteViewsAdapterServiceConnection(474): bind(): Unknown component ComponentInfo{com.bencallis.dealpad/com.bencallis.dealpad.stackwidget.StackWidgetService}

I am sure there is a simple mistake somewhere which is making the component info repeat com.bencallis.dealpad.

Any ideas?

like image 743
bencallis Avatar asked Oct 08 '22 17:10

bencallis


1 Answers

It turned out it was to do with my manifest and a problem locating the service. I was missing a . in the name (which gives it the path).

Silly mistake!

like image 142
bencallis Avatar answered Oct 20 '22 12:10

bencallis