Reputation: 1265
When you normally want to add an AppWidget in Android there is a list where you need to pick one widget and it binds it to the home screen.
I'm trying to build an app which has its own appWidgetHost and specific App Widgets that I built for it.
I have two problems:
To make it simple; There is my app with my AppWidgets and I want full control in terms of binding a appWidget to the appWidgetHost etc.
3 people asked similar questions in Google forums:
The only answer I found to be a possibility is in link number 2. Paraneet (one of the repliers) said that you can install the app under /system/app instead of /data/app because some security issue. but I'm not sure if it is a reliable solution for production, and I would like to know more about the pros and cons of doing this.
Thanks, Shai.
Upvotes: 5
Views: 10096
Reputation: 1746
In Android O, its possible to pin app widget programmatically. Just watch at example here
Also check out Google official documentation
Upvotes: 1
Reputation: 759
Unfortunatlly for you (and me), Paraneet is right.
binding appwidget is a sensitive action and thus, to avoid malware it requires the user's consent for the most part however if you install your app into the /system/data folder then you considered part of the OS and you are given a system permission which lets you decide to bind appwidget that you created without any user's involvement.
Upvotes: 5