Rich Wooley
Rich Wooley

Reputation: 375

Widget appears in Widget Preview but not in the Widget List for Android 4

I have created a simple widget application that works find in the 2.3.3 Simulation. The same widget, when loaded on the Android 4.0.3 or 4.1 simulations, appears on the APPS tab, not the WIDGETS tab. However, it does appear in the widgets listed in the Widgets Preview. When selected in the Widgets Preview, it works properly.

Any suggestions on the best way to debug this issue?

I've read other threads that suggest the application needs to be launched once before it will appear in the Widgets list. I've done that with no success.

Here is the app manifest.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="nds.android.silentmodetoggle"
    android:versionCode="1"
    android:versionName="1.0" >

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

    <application
        android:icon    = "@drawable/icon"
        android:label   = "@string/app_name"
        android:theme   = "@style/AppTheme" >

        <activity
            android:name    = ".MainActivity"
            android:label   = "@string/title_activity_main" >

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

        </activity>

        <receiver
            android:name        = ".AppWidget"
            android:exported    = "false"
            android:label       = "@string/app_name"
            android:icon        = "@drawable/icon" >

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

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

        </receiver>    

        <service android:name       = ".AppWidget$ToggleService" />

    </application>

</manifest>

Upvotes: 3

Views: 886

Answers (2)

LearningForever
LearningForever

Reputation: 1

I think, in xml file: widget_provider, it should add minimum size for widget as below: android:minWidth="xxdp" android:minHeight="yydp"

Try it! It worked fine to me.

Upvotes: 0

Tom
Tom

Reputation: 17854

I think a lot of people are having problems like this (widget not showing up).

I've seen speculation that this is a problem experienced only by 'pure widgets' that have no activity, but that is obviously not your problem.

Myself, I find that the solution to this problem is to uninstall and re-install. Unfortunately, repeating this frequently is rather a pain, and obviously we can't tell our users to do this.

If uninstalling and re-installing work for you, then I would suggest that there is something your widget is doing when it is used that causes it to not work on subsequent attempts.

Upvotes: 1

Related Questions