1

I have an activity called LoginActivity, where in user explicitly logs into the app using username and password. When he logs in I want to register him for push notifications by sending his device token to server. Once his device token in sent to the server, the server sends a confirmation as part of device token registration api. Based on this confirmation, I want to show an alert dialog to user displaying the status of registration.

I don't want to make the user wait till the 'device token registration api' responds, I will navigate user to the home page even before the api responds.

Now that 'device token registration api' can respond at any time (even before home page activity is started or even after home page activity is started), I don't have any reference to a 'context' object to create Alert Dialog.

I can not use broadcast pattern, because the 'device token registration api' can respond even before I register for broadcast receiver in my home activity.

I don't want to use system dialog window, as I read it is not a good practice.
How to solve this?

Shiva
  • 543
  • 1
  • 6
  • 20

0 Answers0