Created
August 23, 2016 01:53
-
-
Save feresr/0b23c8202327995dcdf9855c9712565e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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