android – GCM Notification in Dialog form


I'm making an application that receives alert messages using Google Cloud Messaging, as soon as it receives a message in the background, the App triggers a notification that is on the Android notification bar with this code below:

private void sendNotification(String message) {
    Intent intent = new Intent(this, MainActivity.class);
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,

    Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
            .setContentTitle("GCM Message")

    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    notificationManager.notify(0 /* ID of notification */,;

I would like to display this notification as a Dialog in the Android home , similar to what the "Whoscall" App does when receiving a call. How could this be done?


Erick, from what I've researched this seems to be a bad practice as it confuses the user and can hinder the user in the task he is doing. The correct thing in this situation is to use notifications.

Put a notification with the two actions you want, it's the best way.

For more information:

Scroll to Top