0

I am working on a widget that needs to be displayed on keyguard, so here is my widget info :

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" 
    android:initialKeyguardLayout="@layout/widget_layout"
    android:minWidth="294dp" 
    android:minHeight="72dp" 
    android:updatePeriodMillis="0"
    android:widgetCategory="keyguard">    

</appwidget-provider>

And here is part of my Manifest :

<receiver 
        android:name="com.view.KeyguardWidgetProvider" 
        android:icon="@drawable/idoogood_logo"
        android:label="@string/appwidget_name">
        <intent-filter >
            <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
            <action android:name="android.intent.action.USER_PRESENT"/>
        </intent-filter>
            <meta-data
            android:name="android.appwidget.provider"
            android:resource="@xml/widget_info" />
</receiver>

My problem is that the widget does not appear on the lockscreen. When I swipe the lockscreen to the left of right, nothing happends. And when I go into Settings=>Security, I don't have the option to enable Keyguard widgets. The widget works fine on the home screen.

Thanks for any suggestion.

JDenais
  • 2,956
  • 2
  • 21
  • 30
  • this page might be helpful http://stackoverflow.com/questions/4116001/android-lock-screen-widget – Mr.Dev Jan 18 '15 at 20:49
  • Did you launch on an emulator or a device? And which API level do you have? – Erich Mar 31 '15 at 07:35
  • @Erich thanks for the comment, but this question was for an personal old project that I dropped since then. Especially cause the keyguard feature for widgets is no longer available in Lollipop. But to answer your comment, I used emulators with API level 19. Should I have done it differently? – JDenais Mar 31 '15 at 21:52
  • 1
    Only Android versions lower than 5.0 support lock-screen widgets. For Android 5.0 and higher, only home_screen is valid. – Sadegh Ghanbari Jul 13 '20 at 11:14

0 Answers0