Back to project page droidBBpush.
The source code is released under:
This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a co...
If you think the Android project droidBBpush listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.arg3.examples.droidbb; /* www . j a v a 2s .c o m*/ import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; import com.arg3.examples.droidbb.gcm.GCMHandler; import java.util.Observable; import java.util.Observer; import javax.inject.Inject; public class MainActivity extends ActionBarActivity implements Observer { @Inject GCMHandler push; @Inject PushRegistrar registrar; TextView token; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); MainApplication app = (MainApplication) getApplication(); app.inject(this); token = (TextView) findViewById(R.id.regId); TextView hello = (TextView) findViewById(R.id.greeting); hello.setText("Hello, " + BuildConfig.FLAVOR); token.setText(registrar.getRegistrationId()); } @Override public void onStart() { super.onStart(); registrar.addObserver(this); push.init(this); if (!push.isAvailable()) { token.setText("Not available"); } } @Override protected void onDestroy() { super.onDestroy(); push.destroy(this); } @Override public void update(Observable observable, Object o) { token.setText(registrar.getRegistrationId()); } }