private async void Registrar() { Toast.MakeText(this, "Registrando tus resultados", ToastLength.Short).Show(); TorneoItem registro = new TorneoItem(); registro.DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId); registro.Email = "*****@*****.**"; registro.Reto = "RetoN + 28a90 + https://github.com/Victor-mrc/RetoN"; await ItemManager.DefaultManager.SaveTaskAsynx(registro); }
public async Task SaveTaskAsynx(TorneoItem item) { if (item.Id == null) { await todoTable.InsertAsync(item); } else { await todoTable.UpdateAsync(item); } }
private async void btnRegistrar_ClickAsync(object sender, EventArgs e) { string urlGit = "https://github.com/ranabdiel/Xamarin_Championship_Reto_N"; TorneoItem registro = new TorneoItem(); registro.DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId); registro.Email = "*****@*****.**"; registro.Reto = "RetoN + 54d88 " + urlGit; await manager.SaveTaskAsync(registro); //Toast.MakeText(this, "Registrado Correctamente", ToastLength.Short).Show(); }
protected override void OnMessage(Context context, Intent intent) { string message = string.Empty; // Extract the push notification message from the intent. if (intent.Extras.ContainsKey("message")) { message = intent.Extras.Get("message").ToString(); var result = message.Substring(4, 5); var title = "Championship - Reto N"; // Create a notification manager to send the notification. var notificationManager = GetSystemService(Context.NotificationService) as NotificationManager; // Create a new intent to show the notification in the UI. PendingIntent contentIntent = PendingIntent.GetActivity(context, 0, new Intent(this, typeof(ToDoActivity)), 0); // Create the notification using the builder. var builder = new Notification.Builder(context); builder.SetAutoCancel(true); builder.SetContentTitle(title); builder.SetContentText(message); builder.SetSmallIcon(Resource.Drawable.ic_launcher); builder.SetContentIntent(contentIntent); var notification = builder.Build(); // Display the notification in the Notifications Area. notificationManager.Notify(1, notification); manager = new ItemManager(); Task.Run(async() => { TorneoItem registro = new TorneoItem(); registro.DeviceId = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId); registro.Email = "*****@*****.**"; registro.Reto = $@"RetoN{result}https://github.com/kiramishima/Xamarin-Championship-Reto-N"; await manager.SaveTaskAsync(registro); }).GetAwaiter().GetResult(); } }