There are many options for launch an activity without click on any events in Activity.But i didn't find any solution for launch an activity automatically without click any event on AppWidgetProvider ? Please suggest me a solution
Asked
Active
Viewed 188 times
-1
-
2Please explain, in detail, what exactly the user will do with your app widget that should trigger an activity to start. – CommonsWare Jun 21 '16 at 14:29
-
@CommonsWare I will get a result from webservice.So I will show the result on the widget.Then after 3 seconds I want to open an activity. – mob_web_dev Jun 21 '16 at 14:31
-
Why would the user want you to start an activity in the middle of whatever the user is doing? – CommonsWare Jun 21 '16 at 14:32
-
@CommonsWare: As per the requirement I need to do some actions/features on the activity.Please give me a solution – mob_web_dev Jun 21 '16 at 14:33
-
@CommonsWare : Have you got any idea http://stackoverflow.com/questions/37983302/how-to-show-the-text-selection-cursor-default – mob_web_dev Jun 24 '16 at 08:32
1 Answers
1
I will get a result from webservice
Presumably, your Web service request is being made from a service.
So I will show the result on the widget.
Your service will do that by working with AppWidgetManager
.
Then after 3 seconds I want to open an activity.
Your service is welcome to wait three seconds, then call startActivity()
. You will need to include FLAG_ACTIVITY_NEW_TASK
on the Intent
that you pass to startActivity()
.
Your users, in turn, are welcome to give your app poor reviews, etc. for interrupting them in the middle of whatever they are already doing with their device. Launching an activity from background work is rarely the right solution.
Note that nothing in what you are requesting has anything to do with AppWidgetProvider
.

CommonsWare
- 986,068
- 189
- 2,389
- 2,491