Skip to content

Instantly share code, notes, and snippets.

@feresr
Created August 23, 2016 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feresr/0b23c8202327995dcdf9855c9712565e to your computer and use it in GitHub Desktop.
Save feresr/0b23c8202327995dcdf9855c9712565e to your computer and use it in GitHub Desktop.
import android.os.Bundle;
import android.util.Log;
import com.google.android.gms.gcm.GcmListenerService;
import com.productify.urge.UrgeApplication;
import com.productify.urge.UserManager;
import com.productify.urge.Utils;
import javax.inject.Inject;
public class GCMService extends GcmListenerService {
@Inject
Utils utils;
@Override
public void onCreate() {
super.onCreate();
UrgeApplication.getApp(this).getComponent().inject(this);
}
@Override
public void onMessageReceived(String s, Bundle bundle) {
super.onMessageReceived(s, bundle);
Log.d(this.getClass().getSimpleName(), bundle.getString("message"));
if (!utils.isAppInForeground(this)) {
utils.showNotification(this, bundle.getString("message"));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment