1

I have a basic clock widget here, it works just fine on versions of android below 4.0, you can long press, select widgets and its right there. But when i try to run it on 4.0 or later emulator or real device, it does not show up in widgets section only in Settings>Storage>Apps. I have tried adding a simple activity that just gives users directions on how to install the widget , that suggestion was given as an answer here: Android 4.0: widgets not appearing? . Unless i did it wrong the widget still does not show up in widget drawer.

Here is my manifest:

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="14" />
    <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
       <activity android:name=".MainActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />                
        </intent-filter>
    </activity>
        <receiver android:name=".ExampleAppWidgetProvider"
            android:label="8-bit cloud widget 1">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />

                </intent-filter>
                <meta-data android:name="android.appwidget.provider"
                    android:resource="@xml/widget1_info" />
        </receiver>
    </application>

</manifest>
Community
  • 1
  • 1

3 Answers3

0

add below in your manifest.xml. "android:exported="true". it might help. try it.

tomoroho
  • 51
  • 3
0

In your widget metadata xml file check tag <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:xmlns attribute should start with http://.

Igor Lapin
  • 23
  • 6
0

It looks like you are being hit by a security upgrade which I think happened in HoneyComb.

Basically, in newer versions of Android, you cannot have your widget working, without first launching an Activity.

So add an activity to the project, run it first, and I think your widgets will update.

A good example would be to use a Settings style activity, or perhaps and About box type of thing, to tell the user a bit about your widget. (I use settings in my widgets).


For more info:

Community
  • 1
  • 1
Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255