public class MainActivity extends android.support.v7.app.AppCompatActivity implements GCMRegisterDeviceAsyncTask.OnGCMDeviceRegistrationListener
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
deviceRegistrationId |
private com.google.android.gms.gcm.GoogleCloudMessaging |
googleCloudMessaging |
private static int |
PLAY_SERVICES_RESOLUTION_REQUEST |
private static java.lang.String |
TAG |
| Constructor and Description |
|---|
MainActivity() |
| Modifier and Type | Method and Description |
|---|---|
private boolean |
checkPlayServices()
Check the device to make sure it has the Google Play Services APK.
|
private java.lang.String |
getRegistrationId(Context context)
Method for extracting the stored device registration id.
|
private void |
initializeViews()
Initialize the layout views
|
void |
onCancelled()
Async task callback.
|
protected void |
onCreate(Bundle savedInstanceState) |
void |
onPostExecute(java.lang.String registrationId)
Async task callback.
|
void |
onPreExecute()
Async task callback.
|
void |
registerInBackground()
Using headless fragment with asynchronous task for device registration process.
|
private void |
setListeners()
Sets all required listeners for the views
|
addContentView, getDelegate, getDrawerToggleDelegate, getMenuInflater, getSupportActionBar, getSupportParentActivityIntent, invalidateOptionsMenu, onConfigurationChanged, onContentChanged, onCreateSupportNavigateUpTaskStack, onDestroy, onMenuItemSelected, onPostCreate, onPostResume, onPrepareSupportNavigateUpTaskStack, onStop, onSupportActionModeFinished, onSupportActionModeStarted, onSupportContentChanged, onSupportNavigateUp, onTitleChanged, onWindowStartingSupportActionMode, setContentView, setContentView, setContentView, setSupportActionBar, setSupportProgress, setSupportProgressBarIndeterminate, setSupportProgressBarIndeterminateVisibility, setSupportProgressBarVisibility, startSupportActionMode, supportInvalidateOptionsMenu, supportNavigateUpTo, supportRequestWindowFeature, supportShouldUpRecreateTaskdump, getLastCustomNonConfigurationInstance, getSupportFragmentManager, getSupportLoaderManager, onActivityResult, onAttachFragment, onBackPressed, onCreatePanelMenu, onCreateView, onKeyDown, onLowMemory, onNewIntent, onPanelClosed, onPause, onPrepareOptionsPanel, onPreparePanel, onResume, onResumeFragments, onRetainCustomNonConfigurationInstance, onRetainNonConfigurationInstance, onSaveInstanceState, onStart, setEnterSharedElementCallback, setExitSharedElementCallback, startActivityForResult, startActivityFromFragment, supportFinishAfterTransition, supportPostponeEnterTransition, supportStartPostponedEnterTransitionprivate static final java.lang.String TAG
private static final int PLAY_SERVICES_RESOLUTION_REQUEST
private com.google.android.gms.gcm.GoogleCloudMessaging googleCloudMessaging
private java.lang.String deviceRegistrationId
protected void onCreate(Bundle savedInstanceState)
onCreate in class android.support.v7.app.AppCompatActivityprivate void initializeViews()
private void setListeners()
public void registerInBackground()
private boolean checkPlayServices()
private java.lang.String getRegistrationId(Context context)
context - - application contextpublic void onPreExecute()
onPreExecute in interface GCMRegisterDeviceAsyncTask.OnGCMDeviceRegistrationListenerpublic void onPostExecute(java.lang.String registrationId)
onPostExecute in interface GCMRegisterDeviceAsyncTask.OnGCMDeviceRegistrationListenerpublic void onCancelled()
onCancelled in interface GCMRegisterDeviceAsyncTask.OnGCMDeviceRegistrationListener