protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); editTextRegistrationId = FindViewById <EditText> (Resource.Id.editTextRegistrationId); // Register for the token refresh, simply to update the UI MyRegistrationService.TokenRefreshed += token => { RunOnUiThread(() => { editTextRegistrationId.Text = token; }); }; // Get the last token registered and display immediately var p = GetSharedPreferences("gcmsample", FileCreationMode.Private); editTextRegistrationId.Text = p.GetString("gcm-token", "N/A"); // Initiate GCM registration to see if a new token is returned MyRegistrationService.Register(this); }
public override void OnTokenRefresh() { MyRegistrationService.Register(this); }