Is there any way to convert or declare in the main activity of an app without having access to the source code or using smali? I'd like to have an app as a full-screen widget in nova launcher.
Is there any way to convert or declare in the main activity of an app without having access to the source code or using smali? I'd like to have an app as a full-screen widget in nova launcher.
No, you can't convert an activity into a widget from outside the app. They work in completely different ways. With an activity, the app's process is running and controls all of the GUI controls in the activity. For a widget, the app sends a description of the widget layout (including all the images) to the launcher, and then the launcher's process is responsible for drawing that layout on the screen. The app doesn't run all the time: it only runs when it wants to update the widget layout (e.g. to change the "new mail" count after getting a push notification) or when you interact with the widget.
It works this way because keeping a process running for every widget would use a lot of memory and battery.
With the new multi-window changes in Nougat, it would be possible for a launcher to embed an app's activity as if it were a widget, but the launcher would have to be written to support this, the app would have to support multi-window, and it would still use a lot of memory and battery, and the unusual configuration could well trigger some latent bugs in apps.
Q & A