Search code examples
androidandroid-widgetlockscreen

Android 4.2+ Lockscreen detect widget position


Is there any way to detect your widget position on lockscreen with Android 4.2+? The main question for me is my widget is displayed as default lockscreen widget or user should slide among others widgets to see it?


Solution

  • Actually I've found one way to achieve what I want. When widget is placed on a lockscreen it actually can have two sizes. (Check sizing guidelines for details http://developer.android.com/guide/topics/appwidgets/index.html#lockscreen)

    Bundle myOptions = appWidgetManager.getAppWidgetOptions (widgetId);
    

    The trick is to call and check maxHeight value and check against size of a screen when Intent.ACTION_SCREEN_ON event occurs