WeAreFairphone / FP2-Launcher

Fork of the launcher originally designed for the Fairphone 2, featuring Edge Swipe and Apps Life Cycle
https://forum.fairphone.com/t/publishing-fairphone-specific-apps-launcher-contact-widget-on-f-droid/28008
Other
25 stars 2 forks source link

Default workspace widgets not being inflated #17

Open Roboe opened 6 years ago

Roboe commented 6 years ago

Inherited from #16.

Since Android 4.1, the BIND_APPWIDGET needs explicit permission to load a widget, as stated in the Android docs: https://developer.android.com/guide/topics/appwidgets/host#binding-41 (which IMHO is a little inconsistent with how permissions are asked from Android 6 onwards, but whatever)

The default workspace configuration includes widgets from our package (community.fairphone.fplauncher3) and from external packages (community.fairphone.mycontacts). Neither of them is added by default.

Seems like Workspace.java handles inflating shortcuts and widgets from XML files.

Roboe commented 6 years ago

I'm starting to think this is impossible for third-party launchers...

Not for use by third-party applications.

https://developer.android.com/reference/android/Manifest.permission#BIND_APPWIDGET

The only way around this is for system apps to request android.permission.BIND_APPWIDGET in their manifest, so this method is only available on rooted devices where the app is installed at the system level (in /system/app or /system/priv-app).

https://www.jacobmansfield.co.uk/p/2017/04/25/adding-android-widgets-without-user-interaction/