I have an android widget which has a very simple function. The widget simply launches an activity when pressed, runs through the activity, pops a toast, and closes the activity.
The annoying thing is that when the widget is pressed on the home screen, the screen flickers as it opens and closes the activity. Is there any way to launch the activity from the background, to avoid this flicker? I’m kind of looking to do something similar to the ATK widget, which simply pops up a toast after closing all the background processes.
If it’s possible to just run a single function in place of a PendingIntent, that would definitely work as well. Thanks!
I eventually did this by implementing a service instead of an activity. The service runs in the background and then stops itself once it has finished. The PendingIntent simply launches the service, using the getService() method of PendingIntent.