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 Mobile Service Client instance, using the provided
            // Mobile Service URL
            client = new MobileServiceClient(applicationURL);
            await InitLocalStoreAsync();

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

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

            // Get the Mobile Service sync table instance to use
            toDoTable = client.GetSyncTable <ToDoItem> ();

            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 ();
        }
コード例 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.FirstView);

            // Make sure the device support for google play services
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

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

            TabHost.TabSpec spec;

            spec = TabHost.NewTabSpec("search");
            spec.SetIndicator("", Resources.GetDrawable(Resource.Drawable.indicator_search));
            spec.SetContent(this.CreateIntentFor(FirstViewModel.Search));
            TabHost.AddTab(spec);

            spec = TabHost.NewTabSpec("recent");
            spec.SetIndicator("", Resources.GetDrawable(Resource.Drawable.indicator_history));
            spec.SetContent(this.CreateIntentFor(FirstViewModel.Recent));
            TabHost.AddTab(spec);

            spec = TabHost.NewTabSpec("favourite");

            spec.SetIndicator("", Resources.GetDrawable(Resource.Drawable.indicator_favorite));
            spec.SetContent(this.CreateIntentFor(FirstViewModel.Favourite));
            TabHost.AddTab(spec);
        }
コード例 #3
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            Xamarin.FormsMaps.Init(this, bundle);
            SecureStorageImplementation.StoragePassword = Build.Id;
            global::Xamarin.Forms.Forms.Init(this, bundle);
            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
            CurrentActivity = this;
            LoadApplication(new App());

            try
            {
                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);
            }
        }
コード例 #4
0
        protected override void OnCreate(Bundle bundle)
        {
            instance = this;

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
            LoadApplication(new App());

            try
            {
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);

                System.Diagnostics.Debug.WriteLine("Registrando...");
                GcmClient.Register(this, GcmBroadcastReceiver.SENDER_IDS);
            }
            catch (Java.Net.MalformedURLException)
            {
                createAndShowDialog("Url inválida", "Erro");
            }
            catch (Exception e)
            {
                createAndShowDialog(e.Message, "Erro");
            }
        }
コード例 #5
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            AzurePushNotificationsImplementation.Init(this);
            //Validate if Play Services are supported in the system.
            var gpsAvailable = IsPlayServicesAvailable();

            //Settings.Current.IsPushEnabled = gpsAvailable;
            if (gpsAvailable)
            {
                // Check to ensure everything's set up right
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);
                // Register for push notifications
                StartService(new Intent(this, typeof(PNRegistrationService)));
            }

            LoadApplication(new App(new AndroidInitializer()));
        }
コード例 #6
0
        public async Task InitializeNotificationsAsync()
        {
            try
            {
                // If already registered, then just return so that we only register for push notications once
                if (Locator.Instance.IsPushNotificationsRegistered)
                {
                    return;
                }

                // Check to ensure everything's setup right
                GcmClient.CheckDevice(MainActivity.CurrentActivity);
                GcmClient.CheckManifest(MainActivity.CurrentActivity);

                // Register for push notifications
                System.Diagnostics.Debug.WriteLine("Registering...");
                GcmClient.Register(MainActivity.CurrentActivity, PushHandlerBroadcastReceiver.SENDER_IDS);

                Locator.Instance.IsPushNotificationsRegistered = true;
            }
            catch (Exception e)
            {
                Locator.Instance.IsPushNotificationsRegistered = false;

                CreateAndShowDialog("Registration for push notifications failed:\n\n" + e.Message + "\n\nIf this app is running in an emmulator, make sure that you are deploying to or debugging on a virtual device that has Google APIs set as the target", "Error - Push Registration Failed");
            }
        }
コード例 #7
0
        private async void RegisterForNotifications()
        {
            GcmClient.CheckDevice(this.ApplicationContext);
            GcmClient.CheckManifest(this.ApplicationContext);

            GcmClient.Register(this.ApplicationContext, Constants.GCMProjectIdentifier);
        }
コード例 #8
0
        void RegisterGCM()
        {
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

            GcmClient.Register(this, NotificationConstants.SenderId);
        }
コード例 #9
0
        protected override void OnCreate(Bundle bundle)
        {
            // Push Notification: inicializando a instancia do MainActivity.
            instance = this;

            base.OnCreate(bundle);

            // Initialize Azure Mobile Apps
            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();

            // Initialize Xamarin Forms
            global::Xamarin.Forms.Forms.Init(this, bundle);

            // Load the main application
            LoadApplication(new App());

            // Push Notification
            try {
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);

                // Registra a mensagem no push notifications
                System.Diagnostics.Debug.WriteLine("Enviando...");
                GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS);
            }
            catch (Java.Net.MalformedURLException) {
                CreateAndShowDialog("Ocorreu um erro inesperado. Verifique a URL", "Falha");
            }
            catch (Exception e) {
                CreateAndShowDialog(e.Message, "Falha");
            }

            App.Init((IAuthenticate)this);
        }
コード例 #10
0
        private ProgressBar progressBar;                  // Progress spinner to use for table operations

        // Called when the activity initially gets created
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            // Initialize the progress bar
            progressBar            = FindViewById <ProgressBar>(Resource.Id.loadingProgressBar);
            progressBar.Visibility = ViewStates.Gone;

            // Create ProgressFilter to handle busy state
            var progressHandler = new ProgressHandler();

            progressHandler.BusyStateChange += (busy) => {
                if (progressBar != null)
                {
                    progressBar.Visibility = busy ? ViewStates.Visible : ViewStates.Gone;
                }
            };

            try
            {
                // Check to ensure everything's setup right
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);

                // Register for push notifications
                System.Diagnostics.Debug.WriteLine("Registering...");
                GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS);

                CurrentPlatform.Init();
                // Create the Mobile Service Client instance, using the provided
                // Mobile Service URL and key
                client = new MobileServiceClient(
                    Constants.ApplicationURL,
                    Constants.ApplicationKey, progressHandler);

                // Get the Mobile Service Table instance to use
                todoTable = client.GetTable <TodoItem>();

                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 Service
                await RefreshItemsFromTableAsync();
            }
            catch (Java.Net.MalformedURLException)
            {
                CreateAndShowDialog(new Exception("There was an error creating the Mobile Service. Verify the URL"), "Error");
            }
            catch (Exception e)
            {
                CreateAndShowDialog(e, "Error");
            }
        }
コード例 #11
0
        protected override void OnCreate(Bundle bundle)
        {
            // GCM
            instance = this;
            /////

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
            LoadApplication(new DontBeDoryApp.App());
            MobileAds.Initialize(ApplicationContext, "ca-app-pub-8521044456540023~7459937605");

            // GCM
            try
            {
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);
                System.Diagnostics.Debug.WriteLine("Registering...");
                GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS);
            }
            catch (Java.Net.MalformedURLException)
            {
                CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error");
            }
            catch (Exception e)
            {
                CreateAndShowDialog(e.Message, "Error");
            }
        }
コード例 #12
0
ファイル: Manager.cs プロジェクト: Fedorm/core-master
        public void StartRegisterDevice(Context ctx)
        {
            GcmClient.CheckDevice(ctx);
            GcmClient.CheckManifest(ctx);

            if (!GcmClient.IsRegistered(ctx))
            {
                try
                {
                    string projectId;
                    try
                    {
                        _host     = _host.ToCurrentScheme(false);
                        projectId = GetGoogleProjectId();
                    }
                    catch (WebException e)
                    {
                        _host     = _host.ToCurrentScheme(true);
                        projectId = GetGoogleProjectId();
                    }

                    GcmBroadcastReceiver.SenderIds = new[] { projectId };
                    GcmClient.Register(ctx, GcmBroadcastReceiver.SenderIds);
                }
                catch (Exception e)
                {
                    _applicationContext.HandleException(e);
                }
            }
        }
コード例 #13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            instance = this;
            CurrentPlatform.Init();

            todoItemManager = new ToDoItemManager();
            App.SetTodoItemManager(todoItemManager);

            LoadApplication(new App());

            try
            {
                // Check to ensure everything's setup right
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);

                // Register for push notifications
                System.Diagnostics.Debug.WriteLine("Registering...");
                GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS);
            }
            catch (Java.Net.MalformedURLException)
            {
                CreateAndShowDialog(new Exception("There was an error creating the Mobile Service. Verify the URL"), "Error");
            }
            catch (Exception e)
            {
                CreateAndShowDialog(e, "Error");
            }
        }
コード例 #14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_main);

            Button button = FindViewById <Button>(Resource.Id.btnLogin);

            button.Click += btnGiris_Click;

            txtUsername = FindViewById <EditText>(Resource.Id.txtKullaniciAdi);
            txtPassword = FindViewById <EditText>(Resource.Id.txtPassword);

            Intent servIntent = new Intent(ApplicationContext, typeof(LocationControlService));

            StartService(servIntent);

            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);
            Firebase.FirebaseApp.InitializeApp(this);
            Thread.Sleep(1000);

            //FloatingActionButton fab = FindViewById<FloatingActionButton>(Resource.Id.fab);
            //         fab.Click += FabOnClick;
        }
        //https://azure.microsoft.com/en-us/documentation/articles/xamarin-notification-hubs-push-notifications-android-gcm/

        public void RegisterForAzurePushNotification()
        {
            if (GcmClient.MainActivity != null)
            {
                GcmClient.Register(GcmClient.MainActivity, PushNotificationCredentials.GoogleApiSenderId);
            }
        }
コード例 #16
0
        private void RegistrarApp(Context applicationContext)
        {
            GcmClient.CheckDevice(applicationContext);
            GcmClient.CheckManifest(applicationContext);

            GcmClient.Register(applicationContext, Constantes.SenderId);
        }
 public void UnregisterFromAzurePushNotification()
 {
     if (GcmClient.MainActivity != null)
     {
         GcmClient.UnRegister(GcmClient.MainActivity);
     }
 }
コード例 #18
0
 public static void Register(Context context)
 {
     PushHandlerService.Context = context;
     Console.WriteLine("PushHandlerService - Register");
     // Makes this easier to call from our Activity
     GcmClient.Register(context, AzureNotifier.SenderID);
 }
コード例 #19
0
        protected override void OnCreate(Bundle bundle)
        {
            CurrentActivity = this;
            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
            LoadApplication(new App());

            try
            {
                // Check to ensure everything's setup right
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);

                // Register for push notifications
                System.Diagnostics.Debug.WriteLine("Registering...");
                GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS);
            }
            catch (Java.Net.MalformedURLException)
            {
                CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error");
            }
            catch (Exception e)
            {
                CreateAndShowDialog(e.Message, "Error");
            }
        }
コード例 #20
0
ファイル: MainActivity.cs プロジェクト: ShiroYacha/Elcathon
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            FormsAppCompatActivity.ToolbarResource   = Resource.Layout.Toolbar;
            FormsAppCompatActivity.TabLayoutResource = Resource.Layout.Tabbar;

            // iconify init
            Plugin.Iconize.Iconize.With(new Plugin.Iconize.Fonts.MaterialModule());
            FormsPlugin.Iconize.Droid.IconControls.Init();

            // xlabs init
            var container = new SimpleContainer();

            container.Register <IDevice>(t => AndroidDevice.CurrentDevice);
            container.Register <IDisplay>(t => t.Resolve <IDevice>().Display);
            container.Register <INetwork>(t => t.Resolve <IDevice>().Network);
            Resolver.SetResolver(container.GetResolver());

            global::Xamarin.Forms.Forms.Init(this, bundle);

            // xamarin plugins init
            ImageCircleRenderer.Init();

            // init gcm client
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

            //Call to Register the device for Push Notifications
            GcmClient.Register(this, GcmBroadcastReceiver.SENDER_IDS);

            LoadApplication(new App());
        }
コード例 #21
0
        protected override void OnCreate(Bundle bundle)
        {
            // GCM
            instance = this;
            /////

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);
            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());

            // GCM
            try
            {
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);
                System.Diagnostics.Debug.WriteLine("Registering...");
                GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS);
            }
            catch (Java.Net.MalformedURLException)
            {
                CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error");
            }
            catch (Exception e)
            {
                CreateAndShowDialog(e.Message, "Error");
            }
        }
コード例 #22
0
        public override void OnCreate()
        {
            base.OnCreate();

            var config = new ImageLoaderConfiguration.Builder(this)
                         .MemoryCacheExtraOptions(DroidConstants.ImageSize, DroidConstants.ImageSize) // default = device screen dimensions
                         .DiskCacheExtraOptions(DroidConstants.ImageSize, DroidConstants.ImageSize, null)
                         .ThreadPoolSize(10)                                                          // default
                         .ThreadPriority(Thread.NormPriority - 2)                                     // default
                         .TasksProcessingOrder(QueueProcessingType.Fifo)                              // default
                         .MemoryCacheSize(20 * 1024 * 1024)
                         .MemoryCacheSizePercentage(30)                                               // default
                         .DiskCacheSize(50 * 1024 * 1024)
                         .DiskCacheFileCount(300)
                         .WriteDebugLogs()
                         .Build();

            ImageLoader.Instance.Init(config);
            Crittercism.Init(ApplicationContext, "1c2c97937d6f4d0aa6235204ae512f4000555300");

            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);
            GcmClient.Register(this, GcmBroadcastReceiver.SENDER_IDS);

            var handler = new ApplicationLifecycleHandler();

            RegisterActivityLifecycleCallbacks(handler);
            RegisterComponentCallbacks(handler);
        }
コード例 #23
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            CurrentActivity = this;
            Forms.Init(this, bundle);
            CurrentPlatform.Init();
            App.Init(this);
            new SfRatingRenderer();
            new SfCalendarRenderer();

            ZXing.Net.Mobile.Forms.Android.Platform.Init();
            UserDialogs.Init(() => this);
            FormsVideoPlayer.Init();
            LoadApplication(new App());
            try
            {
                // Check to ensure everything's setup right
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);

                // Register for push notifications
                Debug.WriteLine("Registering...");
                GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS);
            }
            catch (MalformedURLException)
            {
                CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error");
            }
            catch (System.Exception e)
            {
                CreateAndShowDialog(e.Message, "Error");
            }
        }
コード例 #24
0
        private void RegisterForPushNotifications()
        {
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

            GcmClient.Register(this, GcmBroadcastReceiver.SENDER_IDS);
        }
コード例 #25
0
        protected override void OnCreate(Bundle bundle)
        {
            // Set the current instance of MainActivity.
            instance = this;

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            Xamarin.Forms.Forms.Init(this, bundle);
            Xamarin.FormsMaps.Init(this, bundle);
            App.Init((IAuthenticate)this);
            LoadApplication(new App());

            try
            {
                // Check to ensure everything's setup right
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);

                // Register for push notifications
                System.Diagnostics.Debug.WriteLine("Registering...");
                GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS);
            }
            catch (Java.Net.MalformedURLException)
            {
                CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error");
            }
            catch (Exception e)
            {
                CreateAndShowDialog(e.Message, "Error");
            }
        }
コード例 #26
0
ファイル: MainActivity.cs プロジェクト: carlos2380/APB
        void updateView()
        {
            //Get the stored latest registration id
            var registrationId = GcmClient.GetRegistrationId(this);

            //If it's empty, we need to register
            if (string.IsNullOrEmpty(registrationId))
            {
                registered = false;
                this.textRegistrationStatus.Text = "Registered: No";
                this.textRegistrationId.Text     = "Id: N/A";
                this.buttonRegister.Text         = "Register...";

                Log.Info(TAG, "Not registered...");
            }
            else
            {
                registered = true;
                this.textRegistrationStatus.Text = "Registered: Yes";
                this.textRegistrationId.Text     = "Id: " + registrationId;
                this.buttonRegister.Text         = "Unregister...";

                Log.Info(TAG, "Already Registered: " + registrationId);
            }

            var prefs = GetSharedPreferences(this.PackageName, FileCreationMode.Private);

            this.textLastMsg.Text = "Last Msg: " + prefs.GetString("last_msg", "N/A");

            //Enable the button as it was normally disabled
            this.buttonRegister.Enabled = true;
        }
コード例 #27
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;

            ToDoActivity.instance = this;
            GcmClient.CheckDevice(this); GcmClient.CheckManifest(this);

            GcmClient.Register(this, ToDoBroadcastReceiver.senderIDs);
            // Load the items from the mobile app backend.
            OnRefreshItemsSelected();
        }
コード例 #28
0
        protected override void OnCreate(Bundle bundle)
        {
            instance = this;

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            ImageCircleRenderer.Init();
            LoadApplication(new App());

            try
            {
                //instalado a library GcmClient e verificamos se está tudo Ok
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);

                System.Diagnostics.Debug.WriteLine("Registering...");
                GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS);
            }
            catch (Java.Net.MalformedURLException)
            {
                CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error");
            }
            catch (Exception ex)
            {
                CreateAndShowDialog(ex.Message, "Error");
            }
        }
コード例 #29
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            this.Window.AddFlags(WindowManagerFlags.Fullscreen);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();

            App.UIContext = this;
            LoadApplication(new ContosoInsurance.App());

            instance = this;

            #if PUSH // need to use a Google image on an Android emulator
            try {
                // Check to ensure everything's setup right
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);

                // Register for push notifications
                System.Diagnostics.Debug.WriteLine("Registering...");
                GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS);
            }
            catch (Java.Net.MalformedURLException) {

                CreateAndShowDialog(new Exception("There was an error creating the Mobile Service. Verify the URL"), "Error");
            }
            catch (Exception e) {
                CreateAndShowDialog(e, "Error");
            }
            #endif
        }
コード例 #30
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);
            SecureStorageImplementation.StoragePassword = Build.Id;
            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();

            global::Xamarin.Forms.Forms.Init(this, bundle);
            ImageCircleRenderer.Init();
            LoadApplication(new App());

            try
            {
                GcmClient.CheckDevice(this);
                GcmClient.CheckManifest(this);

                // Register for push notifications
                System.Diagnostics.Debug.WriteLine("Registering...");
                GcmClient.Register(this, GcmService.SenderId);
            }
            catch (Java.Net.MalformedURLException)
            {
                CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error");
            }
            catch (Exception e)
            {
                CreateAndShowDialog(e.Message, "Error");
            }
        }