コード例 #1
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Activity_To_Do);

            CurrentPlatform.Init();

            // Create the client instance, using the mobile app backend URL.
            client = new MobileServiceClient(applicationURL);
#if OFFLINE_SYNC_ENABLED
            await InitLocalStoreAsync();

            // Get the sync table instance to use to store TodoItem rows.
            todoTable = client.GetSyncTable <ToDoItem>();
#else
            todoTable = client.GetTable <ToDoItem>();
#endif

            textNewToDo = FindViewById <EditText>(Resource.Id.textNewToDo);

            // Create an adapter to bind the items with the view
            adapter = new ToDoItemAdapter(this, Resource.Layout.Row_List_To_Do);
            var listViewToDo = FindViewById <ListView>(Resource.Id.listViewToDo);
            listViewToDo.Adapter = adapter;

            // Load the items from the mobile app backend.
            OnRefreshItemsSelected();

            try
            {
                // Set the current instance of TodoActivity.
                instance = this;
                // Register the app for push notifications. G
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);

                // Nos registramos por notificaciones push
                System.Diagnostics.Debug.WriteLine("Registrando...");
                GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS);
            }
            catch (Java.Net.MalformedURLException)
            {
                System.Diagnostics.Debug.WriteLine("Error creando el cliente. Verifica la URL.");
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
        }
コード例 #2
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Activity_To_Do);

            CurrentPlatform.Init();

            // Create the client instance, using the mobile app backend URL.
            client = new MobileServiceClient(applicationURL);
#if OFFLINE_SYNC_ENABLED
            await InitLocalStoreAsync();

            // Get the sync table instance to use to store TodoItem rows.
            todoTable = client.GetSyncTable <ToDoItem>();
#else
            todoTable = client.GetTable <ToDoItem>();
#endif

            textNewToDo = FindViewById <EditText>(Resource.Id.textNewToDo);

            // Create an adapter to bind the items with the view
            adapter = new ToDoItemAdapter(this, Resource.Layout.Row_List_To_Do);
            var listViewToDo = FindViewById <ListView>(Resource.Id.listViewToDo);
            listViewToDo.Adapter = adapter;

            // Set the current instance of TodoActivity.
            instance = this;
            // Make sure the GCM client is set up correctly.
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);
            // Register the app for push notifications.
            GcmClient.Register(this, ToDoBroadcastReceiver.senderIDs);

            ServiceHelper serviceHelper = new ServiceHelper();
            string        AndroidId     = Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId);

            var retoN = "RetoN+83d2d+https://github.com/AngelCortes/Xamarin-Championship-Reto-N";

            //Toast.MakeText(this, "Enviando tu registro", ToastLength.Short).Show();
            //await serviceHelper.InsertarEntidad("*****@*****.**", retoN, AndroidId);
            //Toast.MakeText(this, "Gracias por registrarte", ToastLength.Long).Show();


            // Load the items from the mobile app backend.
            OnRefreshItemsSelected();
        }
コード例 #3
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Activity_To_Do);

            CurrentPlatform.Init();

            // Create the client instance, using the mobile app backend URL.
            client = new MobileServiceClient(applicationURL);

            // Set the current instance of TodoActivity.
            ToDoActivity.instance = this;

            // Make sure the GCM client is set up correctly.
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

            // Register the app for push notifications.
            GcmClient.Register(this, ToDoBroadcastReceiver.senderIDs);

#if OFFLINE_SYNC_ENABLED
            await InitLocalStoreAsync();

            // Get the sync table instance to use to store TodoItem rows.
            todoTable = client.GetSyncTable <ToDoItem>();
#else
            todoTable = client.GetTable <ToDoItem>();
#endif

            textNewToDo = FindViewById <EditText>(Resource.Id.textNewToDo);

            // Create an adapter to bind the items with the view
            adapter = new ToDoItemAdapter(this, Resource.Layout.Row_List_To_Do);
            var listViewToDo = FindViewById <ListView>(Resource.Id.listViewToDo);
            listViewToDo.Adapter = adapter;

            // Load the items from the mobile app backend.
            OnRefreshItemsSelected();

            RegistrarReto();
        }
コード例 #4
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Activity_To_Do);

            CurrentPlatform.Init();

            // Create the client instance, using the mobile app backend URL.
            client = new MobileServiceClient(applicationURL);

            ToDoActivity.instance = this;
            Gcm.Client.GcmClient.CheckManifest(this);
            Gcm.Client.GcmClient.Register(this, ToDoBroadcastReceiver.senderIDs);



#if OFFLINE_SYNC_ENABLED
            await InitLocalStoreAsync();

            // Get the sync table instance to use to store TodoItem rows.
            todoTable = client.GetSyncTable <ToDoItem>();
#else
            todoTable = client.GetTable <ToDoItem>();
#endif

            textNewToDo = FindViewById <EditText>(Resource.Id.textNewToDo);

            // Create an adapter to bind the items with the view
            adapter = new ToDoItemAdapter(this, Resource.Layout.Row_List_To_Do);
            var listViewToDo = FindViewById <ListView>(Resource.Id.listViewToDo);
            listViewToDo.Adapter = adapter;

            // Load the items from the mobile app backend.
            OnRefreshItemsSelected();

            Services.ServiceHelper client2 = new Services.ServiceHelper();

            ;

            await client2.InsertarEntidad("*****@*****.**", "RetoN + cf170 + https://github.com/iperezmx87/RetosXamarinChamp/RetoN", Android.Provider.Settings.Secure.GetString(ContentResolver, Android.Provider.Settings.Secure.AndroidId));
        }