Skip to content

Instantly share code, notes, and snippets.

@feresr
Created Aug 23, 2016
Embed
What would you like to do?
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