Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            _instance = this;

            TabLayoutResource = Resource.Layout.tabs;
            ToolbarResource   = Resource.Layout.toolbar;

            base.OnCreate(bundle);

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

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

            LoadApplication(new App(new AndroidInitializer()));

            try
            {
                // Check to ensure everything's set up 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 e)
            {
                Log.Error("Error: ", e.Message);
            }
            catch (Exception e)
            {
                Log.Error("Error: ", e.Message);
            }
        }
Пример #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);
            }
        }
        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");
            }
        }
Пример #5
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");
            }
        }
        //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);
            }
        }
        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");
            }
        }
Пример #8
0
        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);
                }
            }
        }
Пример #9
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");
            }
        }
Пример #10
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");
            }
        }
Пример #11
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");
            }
        }
Пример #12
0
		public static async Task<bool> RegisterService(Context context)
		{
			try
			{
				// Check to ensure everything's set up right
				GcmClient.CheckDevice(context);
				GcmClient.CheckManifest(context);

				// Register for push notifications
				System.Diagnostics.Debug.WriteLine("Registering...");
				GcmClient.Register(context, PushHandlerBroadcastReceiver.SENDER_IDS);
				return await Task.Run(() => true);
			}
			catch (Java.Net.MalformedURLException) 
			{
                if (context is MainActivity)
				    (context as MainActivity).CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error");

                return await Task.Run(() => false);
			}
			catch (Exception e)
			{
				if (context is MainActivity)
					(context as MainActivity).CreateAndShowDialog(e.Message, "Error");

                return await Task.Run(() => false);
			}
		}
Пример #13
0
 public void Start(string userName)
 {
     this.userName = userName;
     GcmClient.CheckDevice(context);
     GcmClient.CheckManifest(context);
     GcmClient.Register(context, Constants.ProjectId);
 }
Пример #14
0
        /// <summary>
        /// For Android project, obj must be the MainActivity.
        /// </summary>
        /// <param name="obj"></param>
        public void RegisterForAzurePushNotification()
        {
            if (MainActivityInstance == null)
            {
                Log.Info("MainActivityInstance", "MainActivityInstance = null;");

                throw new Exception("You need to set AzurePushNotificationImplementation.MainActivityInstance to your MainActivity inside MainActivity.cs before calling LoadApplication(new App());");
            }

            try
            {
                // Check to ensure everything's set up right
                GcmClient.CheckDevice(MainActivityInstance);
                GcmClient.CheckManifest(MainActivityInstance);

                // Register for push notifications
                Log.Info("MainActivity", "Registering...");

                GcmClient.Register(MainActivityInstance, MyBroadcastReceiver.SENDER_IDS);

                Log.Info("MainActivity", "Completed Registering.");
            }
            catch (Exception exc)
            {
                Log.Info("Exception : ", exc.Message);
            }
        }
Пример #15
0
        private void RegisterForPushNotifications()
        {
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

            GcmClient.Register(this, GcmBroadcastReceiver.SENDER_IDS);
        }
Пример #16
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");
            }
        }
Пример #17
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");
            }
        }
Пример #18
0
        void RegisterGCM()
        {
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

            GcmClient.Register(this, NotificationConstants.SenderId);
        }
Пример #19
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");
            }
        }
Пример #20
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);
        }
Пример #21
0
        private async void RegisterForNotifications()
        {
            GcmClient.CheckDevice(this.ApplicationContext);
            GcmClient.CheckManifest(this.ApplicationContext);

            GcmClient.Register(this.ApplicationContext, Constants.GCMProjectIdentifier);
        }
        private void RegistrarApp(Context applicationContext)
        {
            GcmClient.CheckDevice(applicationContext);
            GcmClient.CheckManifest(applicationContext);

            GcmClient.Register(applicationContext, Constantes.SenderId);
        }
Пример #23
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");
            }
        }
Пример #24
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);
 }
Пример #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
        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());
        }
Пример #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
        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);
        }
Пример #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)
        {
            instance = this;

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

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            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)
            {
            }
            catch (Exception e)
            {

            }
        }