[SOLVED] Android Push notification (slow)


I have IIS server and send Notification with GoogleCloudMessaging to phone. It takes about 10 minutes to receive the message on android device. It’s huge time form my project. do you know how decrease the time ?

That is server C# code (Using PushSharp)

var push = new PushBroker();

        //Wire up the events for all the services that the broker registers
        /*NotificationSent s = new NotificationSent()
        push.OnNotificationSent += "NotificationSent";
        push.OnChannelException += "ChannelException";
        push.OnServiceException += "ServiceException";
        push.OnNotificationFailed += "NotificationFailed";
        push.OnDeviceSubscriptionExpired += "DeviceSubscriptionExpired";
        push.OnDeviceSubscriptionChanged += "DeviceSubscriptionChanged";
        push.OnChannelCreated += "ChannelCreated";
        push.OnChannelDestroyed += "ChannelDestroyed";

        push.RegisterGcmService(new GcmPushChannelSettings("MY API KEY"));

        push.QueueNotification(new GcmNotification().
            ForDeviceRegistrationId("PHONE REGISTRATION ID")
                              .WithJson(@"{""alert"":""Name !"",""badge"":7,""sound"":""sound.caf""}"));

        //Stop and wait for the queues to drains

And This Is my receiver,

public class GcmBroadcastReceiver extends WakefulBroadcastReceiver {

public void onReceive(Context context, Intent intent) {
     // Explicitly specify that GcmIntentService will handle the intent.
    ComponentName comp = new ComponentName(context.getPackageName(),
    // Start the service, keeping the device awake while it is launching.
    startWakefulService(context, (intent.setComponent(comp)));




The problem was that many wifi routers close connection to server and the device needs time to reconnect to Google server after wifi closes connection.

The solution is to send heartbeat packages every 3-4 minutes to have permanent connection.

Answered By – Misha Akopov

Answer Checked By – Pedro (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *