protected override void OnHandleIntent(Intent intent)
        {
            try
            {
                Log.Info ("RegistrationIntentService", "Calling InstanceID.GetToken");
                lock (locker)
                {
                    ServiceControlloImpianti s = new ServiceControlloImpianti();

                    Ute =intent.GetStringExtra("Ute");
                    var instanceID = InstanceID.GetInstance (this);
                    var token = instanceID.GetToken ("162590404769",
                        GoogleCloudMessaging.InstanceIdScope, null);
                    if(!s.RegisterDeviceID(token,Ute)) {
                        Log.Info("GennyFrungilloLog", "Non registrato al servizio");
                    }else {
                        Log.Info("GennyFrungilloLog", "Registrato al servizio");
                    }
                    Log.Info ("RegistrationIntentService", "GCM Registration Token: " + token);
                    SendRegistrationToAppServer (token);
                    Subscribe (token);
                }
            }
            catch (Exception e)
            {
                Log.Debug("RegistrationIntentService", "Failed to get a registration token:"+e.Message.ToString());
                return;
            }
        }
Exemple #2
0
 void BtnSalvaStato_Click(object sender, EventArgs e)
 {
     ServiceControlloImpianti s = new ServiceControlloImpianti ();
     s.BeginSalvaStatoAttivitaCommessa (commessa, (ar) => {
         bool esito = s.EndSalvaStatoAttivitaCommessa(ar);
         if(esito) {
             RunOnUiThread(()=>{	Toast.MakeText(this, "Stato salvato correttamente...", ToastLength.Long).Show();});
             SetResult(Result.Ok);
             this.Finish();
         } else {
             RunOnUiThread(()=>{	Toast.MakeText(this, "ERRORE SALVATAGGIO STATO", ToastLength.Long).Show();});
         }
     }, null);
 }