Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            ToolbarResource   = Resource.Layout.toolbar;
            TabLayoutResource = Resource.Layout.tabs;

            base.OnCreate(savedInstanceState);

            Forms.Init(this, savedInstanceState);
            FormsMaps.Init(this, savedInstanceState);
            AndroidAppLinks.Init(this);
            Toolkit.Init();

            PullToRefreshLayoutRenderer.Init();
            typeof(Color).GetProperty("Accent", BindingFlags.Public | BindingFlags.Static).SetValue(null, Color.FromHex("#757575"));

            ImageCircle.Forms.Plugin.Droid.ImageCircleRenderer.Init();

            ZXing.Net.Mobile.Forms.Android.Platform.Init();
#if ENABLE_TEST_CLOUD
            //Mapping StyleID to element content descriptions
            Xamarin.Forms.Forms.ViewInitialized += (object sender, Xamarin.Forms.ViewInitializedEventArgs e) => {
                if (!string.IsNullOrWhiteSpace(e.View.StyleId))
                {
                    e.NativeView.ContentDescription = e.View.StyleId;
                }
            };
#endif

#if !ENABLE_TEST_CLOUD
            InitializeHockeyApp();
#endif

            LoadApplication(new App());

            var gpsAvailable = IsPlayServicesAvailable();
            Settings.Current.PushNotificationsEnabled = gpsAvailable;

            OnNewIntent(Intent);


            if (!string.IsNullOrWhiteSpace(Intent?.Data?.LastPathSegment))
            {
                switch (Intent.Data.LastPathSegment)
                {
                case "sessions":
                    MessagingService.Current.SendMessage <DeepLinkPage>("DeepLinkPage", new DeepLinkPage
                    {
                        Page = AppPage.Sessions
                    });
                    break;

                case "events":
                    MessagingService.Current.SendMessage <DeepLinkPage>("DeepLinkPage", new DeepLinkPage
                    {
                        Page = AppPage.Events
                    });
                    break;

                case "minihacks":
                    MessagingService.Current.SendMessage <DeepLinkPage>("DeepLinkPage", new DeepLinkPage
                    {
                        Page = AppPage.MiniHacks
                    });
                    break;
                }
            }

            if (!Settings.Current.PushNotificationsEnabled)
            {
                return;
            }
#if ENABLE_TEST_CLOUD
#else
            RegisterWithGCM();
#endif

            DataRefreshService.ScheduleRefresh(this);
        }
 public DataRefreshServiceBinder(DataRefreshService service)
 {
     this.service = service;
 }