Search code examples
androidandroid-alertdialogwakelockcommonsware-cwac

Display Alert Dialog after WakefulIntentService completes?


I am using commansware example for wakefulIntentService. I am stuck at a point where I am not able to create alert dialog for the user after my doWakefulWork() gets the updated response from the backend?

I am starting this service and closing as soon as i get the favorable response. I have my polling interval as 2 mins and max this service can poll for 3 attempts that is 6 min. I donot want to display notifications and toast message as I want to capture other event on button click of this alert dialog.

Any help on how to alert the user of this update?


Solution

  • You cannot raise a Dialog from a Service. This has nothing to do with WakefulIntentService.

    You are welcome to start an activity from your service, perhaps an activity that uses a theme that makes it look like a dialog.