Reputation: 117
I want push notification as popup message .I dont want to show it top of the status bar . when ever push notification arrives .Please help me!!
Upvotes: 1
Views: 4615
Reputation: 14103
You can, through every Dialog
classes available in Android. For more information, this should help you.
However, Google did design for Android a notification bar and a Notification API probably because they would like you to use it. Using Dialogs
causes bad and interrupted user experience. Moreover, there are several other technical advantages of using Notifications over Dialogs
:
Dialogs
pauses your activity in the background, a notification doesn't.Dialog
hardly can beI would advise you to use Notifications
whenever you need to advertise the user of an asynchronous event he might be interested in. I would then recommend using Dialogs
as text inputs (credentials for instance) or whenever you need to prompt the user to make an explicit decision.
Upvotes: 2
Reputation: 10542
First of all, i think you shouldn't do it, the notification patter is perfect to not be too much intrusive to the User UX.
But if you realy want to do it you can't do it with a common AlertDialog cause you won't have any reference to an activity.
So what you can do is to start an Activity with Theme.Holo.Dialog set as style.
Start the activity like this:
Intent i = new Intent(context, YourActivityClass.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
Upvotes: 2