Search code examples
androidandroid-intentandroid-activityandroid-widgetappwidgetprovider

Start another activity without click on any event from AppWidgetProvider


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


Solution

  • 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.