0

Is it possible to send a push notification to a user after they have left an android app for a defined period of time?

Cobi
  • 23
  • 1
  • 6

1 Answers1

0

Yes of course!

You should suscribe your android to your GcmBroadcastReceiver class. and add the permission

Your class will tell when a push message arrives, and be handled by your class in your app.

Here is an example:

public class GcmBroadcastReceiver extends WakefulBroadcastReceiver{
    @Override
    public void onReceive(Context context, Intent intent) {
        // Explicitly specify that GcmIntentService will handle the intent.
        ComponentName comp = new ComponentName(context.getPackageName(),
                GcmIntentService.class.getName());
        // Start the service, keeping the device awake while it is launching.
        startWakefulService(context, (intent.setComponent(comp)));
        setResultCode(Activity.RESULT_OK);
    }

}
Nacho
  • 2,057
  • 2
  • 23
  • 32
  • Hey, thanks for the response. I'm pretty new to Android development so please forgive my ignorance. What do you mean by subscribe your android to your GcmBroadcastReceiver class? – Cobi Jun 17 '14 at 14:21
  • i asume you are using GCM yo implement the push service...here you can find how to implement it. You will se, you have the GcmBroadcastReciever. https://developer.android.com/google/gcm/client.html – Nacho Jun 18 '14 at 01:01