protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); //CrossCurrentActivity.Current.Init(this, bundle); CachedImageRenderer.Init(false); AnimationViewRenderer.Init(); FormsMaps.Init(this, bundle); CarouselViewRenderer.Init(); Xamarin.Essentials.Platform.Init(this, bundle); // Configure App Center Push Push.SetSenderId("597659151602"); // Initialize App Indexing and Deep Links FirebaseApp.InitializeApp(this); AndroidAppLinks.Init(this); // Configure Authentication AuthenticationService.UIParent = new UIParent(this); LoadApplication(new App()); }
protected override void OnCreate(Bundle bundle) { ToolbarResource = Resource.Layout.Toolbar; TabLayoutResource = Resource.Layout.Tabbar; // Uncomment the next line to run this as a full screen app (no status bar) //Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.TurnScreenOn); base.OnCreate(bundle); #if TEST_EXPERIMENTAL_RENDERERS // CollectionView lets us test CollectionView stuff until it's officially released Forms.SetFlags("FastRenderers_Experimental"/*, "CollectionView_Experimental", "Visual_Experimental"*/); #else // Fake_Flag is here so we can test for flag initialization issues // CollectionView lets us test CollectionView stuff until it's officially released Forms.SetFlags("Fake_Flag"/*, "CollectionView_Experimental", "Visual_Experimental"*/); #endif Forms.Init(this, bundle); FormsMaps.Init(this, bundle); AndroidAppLinks.Init(this); Forms.ViewInitialized += (sender, e) => { // if (!string.IsNullOrWhiteSpace(e.View.StyleId)) { // e.NativeView.ContentDescription = e.View.StyleId; // } }; // uncomment to verify turning off title bar works. This is not intended to be dynamic really. //Forms.SetTitleBarVisibility (AndroidTitleBarVisibility.Never); if (RestartAppTest.App != null) { _app = (App)RestartAppTest.App; RestartAppTest.Reinit = true; } else { _app = new App(); } // When the native control gallery loads up, it'll let us know so we can add the nested native controls MessagingCenter.Subscribe<NestedNativeControlGalleryPage>(this, NestedNativeControlGalleryPage.ReadyForNativeControlsMessage, AddNativeControls); // When the native binding gallery loads up, it'll let us know so we can set up the native bindings MessagingCenter.Subscribe<NativeBindingGalleryPage>(this, NativeBindingGalleryPage.ReadyForNativeBindingsMessage, AddNativeBindings); // Listen for the message from the status bar color toggle test MessagingCenter.Subscribe<AndroidStatusBarColor>(this, AndroidStatusBarColor.Message, color => SetStatusBarColor(global::Android.Graphics.Color.Red)); SetUpForceRestartTest(); LoadApplication(_app); if (Forms.Flags.Contains("FastRenderers_Experimental")) { var masterPage = ((_app.MainPage as MasterDetailPage)?.Master as ContentPage); if (masterPage != null) masterPage.Content = new Label { Text = "Fast Renderers" }; } }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental"); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); AndroidAppLinks.Init(this); LoadApplication(new App()); if (Intent != null && Intent.DataString != null) { try { string email = ""; email = Intent.Data.GetQueryParameter("email"); if (email != null && email != "") { Xamarin.Forms.MessagingCenter.Send <string, string>("", "AppLaunchedFromDeepLink", email); } } catch (Exception e) { //Catch error } } }
public void sendIntent(string zpTransToken) { Console.WriteLine(">>> CallNativeSdkDroid:sendIntent ---> " + zpTransToken); Console.WriteLine(">>>> " + MainActivity.getCurrentActivity().ToString()); AndroidAppLinks.Init(MainActivity.getCurrentActivity()); try { //Intent intent = new Intent(Intent.ActionSend); //intent.AddFlags(ActivityFlags.NewTask); ////intent.AddFlags(ActivityFlags.SingleTop); //intent.PutExtra("zptranstoken", zpTransToken); ////StartActivityForResult(intent, 0); //Forms.Context.StartActivity(intent); //var pm = Android.App.Application.Context.PackageManager; //var uri = Android.Net.Uri.Parse("vn.com.vng.zalopay.sbmc"); //var intent = new Intent(Intent.ActionView, uri); //Xamarin.Forms.Forms.Context.StartActivity(intent); //MainActivity.getCurrentContext().StartActivity(intent); PayOrderListener payOrderListener = new PayOrderListener(); ZaloPaySDK.Instance.PayOrder(MainActivity.getCurrentActivity(), zpTransToken ?? string.Empty, "demozpdk://xamarinapp", payOrderListener); } catch (Exception e) { Console.WriteLine("Exception >>> " + e.ToString()); } }
protected override void OnCreate(Bundle savedInstanceState) { FormsAppCompatActivity.ToolbarResource = Resource.Layout.Toolbar; FormsAppCompatActivity.TabLayoutResource = Resource.Layout.Tabs; base.OnCreate(savedInstanceState); UserDialogs.Init(this); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); AndroidAppLinks.Init(this); var data = Intent?.Data?.EncodedAuthority.ToString(); //Uri data = getIntent().getData(); //String scheme = data.getScheme(); // "http" //String host = data.getHost(); // "twitter.com" //List < String > params = data.getPathSegments(); //String first = params.get(0); // "status" //String second = params.get(1); // "1234" App.Navigation.PushModalAsync(new WowonderPhone.MainPage()); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); var options = new FirebaseOptions.Builder() .SetApplicationId("Firebase-ApplicationId") .SetApiKey("Firebase-WebApi-Key") .SetGcmSenderId("FCM-Sender-Id") .Build(); try { FirebaseApp.InitializeApp(this, options); AndroidAppLinks.Init(this); } catch { // ignored } LoadApplication(new App()); }
protected override void OnCreate(Bundle bundle) { try { //TabLayoutResource = Resource.Layout.Tabbar; //ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); AndroidAppLinks.Init(this); if (Intent.HasExtra(NOTIF_URL)) { LoadApplication(new App(Intent.GetStringExtra(NOTIF_URL))); } else { LoadApplication(new App()); ScheduleNotificationCheck(); } } catch (Exception bug) { } }
protected override void OnCreate(Bundle savedInstanceState) { FormsAppCompatActivity.ToolbarResource = Resource.Layout.toolbar; FormsAppCompatActivity.TabLayoutResource = Resource.Layout.tabs; base.OnCreate(savedInstanceState); Forms.Init(this, savedInstanceState); FormsMaps.Init(this, savedInstanceState); AndroidAppLinks.Init(this); Toolkit.Init(); //ZXing.Net.Mobile.Forms.Android.Platform.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; if (gpsAvailable) { client = new GoogleApiClient.Builder(this) .AddApi(AppIndex.API) .Build(); } OnNewIntent(Intent); if (!Settings.Current.PushNotificationsEnabled) { return; } #if ENABLE_TEST_CLOUD #else RegisterWithGCM(); #endif DataRefreshService.ScheduleRefresh(this); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); AndroidAppLinks.Init(this); LoadApplication(new App()); }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); AndroidAppLinks.Init(this); FirebaseApp.InitializeApp(this); LoadApplication(new App()); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); AndroidAppLinks.Init(this); LoadApplication(new WebinarDemos.App()); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Check that the data has been retrieved from google-services.json //var apps = FirebaseApp.GetApps(this); Xamarin.Forms.Forms.Init(this, bundle); FirebaseApp.InitializeApp(this); AndroidAppLinks.Init(this); LoadApplication(new App()); }
protected override void OnCreate(Bundle bundle) { ToolbarResource = Resource.Layout.Toolbar; TabLayoutResource = Resource.Layout.Tabbar; // Uncomment the next line to run this as a full screen app (no status bar) //Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.TurnScreenOn); base.OnCreate(bundle); if (!Debugger.IsAttached) { Insights.Initialize(App.InsightsApiKey, ApplicationContext); } #if TEST_EXPERIMENTAL_RENDERERS Forms.SetFlags("FastRenderers_Experimental"); #else Forms.SetFlags("Fake_Flag"); // So we can test for flag initialization issues #endif Forms.Init(this, bundle); FormsMaps.Init(this, bundle); AndroidAppLinks.Init(this); Forms.ViewInitialized += (sender, e) => { // if (!string.IsNullOrWhiteSpace(e.View.StyleId)) { // e.NativeView.ContentDescription = e.View.StyleId; // } }; // uncomment to verify turning off title bar works. This is not intended to be dynamic really. //Forms.SetTitleBarVisibility (AndroidTitleBarVisibility.Never); _app = new App(); // When the native control gallery loads up, it'll let us know so we can add the nested native controls MessagingCenter.Subscribe <NestedNativeControlGalleryPage>(this, NestedNativeControlGalleryPage.ReadyForNativeControlsMessage, AddNativeControls); // When the native binding gallery loads up, it'll let us know so we can set up the native bindings MessagingCenter.Subscribe <NativeBindingGalleryPage>(this, NativeBindingGalleryPage.ReadyForNativeBindingsMessage, AddNativeBindings); // Listen for the message from the status bar color toggle test MessagingCenter.Subscribe <AndroidStatusBarColor>(this, AndroidStatusBarColor.Message, color => SetStatusBarColor(global::Android.Graphics.Color.Red)); SetUpForceRestartTest(); LoadApplication(_app); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Forms.Init(this, bundle); Exrin.Framework.App.Init(new PlatformOptions() { Platform = Device.RuntimePlatform }); AndroidAppLinks.Init(this); var action = Intent?.Action; var data = Intent?.Data; LoadApplication(new App(new Bootstrapper())); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); TabLayoutResource = Resource.Layout.tabs; ToolbarResource = Resource.Layout.toolbar; global::Xamarin.Forms.Forms.Init(this, bundle); AndroidAppLinks.Init(this); BlobCache.ApplicationName = "SimpleUITestApp"; BlobCache.EnsureInitialized(); Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); LoadApplication(App = new App()); }
protected override void OnCreate(Bundle savedInstanceState) { FormsAppCompatActivity.ToolbarResource = Resource.Layout.Toolbar; FormsAppCompatActivity.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(); InitializeHockeyApp(); open.conference.app.Utils.Helpers.Settings.SqlitePath = GetSqlitePlatformPath(); LoadApplication(new OpenConferenceApplication(new DroidInitializer())); var gpsAvailable = IsPlayServicesAvailable(); open.conference.app.Utils.Helpers.Settings.Current.PushNotificationsEnabled = gpsAvailable; if (gpsAvailable) { client = new GoogleApiClient.Builder(this) .AddApi(AppIndex.API) .Build(); } OnNewIntent(Intent); if (!open.conference.app.Utils.Helpers.Settings.Current.PushNotificationsEnabled) { return; } RegisterWithGCM(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); TabLayoutResource = Resource.Layout.tabs; ToolbarResource = Resource.Layout.toolbar; Xamarin.Forms.Forms.SetFlags("FastRenderers_Experimental"); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); AndroidAppLinks.Init(this); BlobCache.ApplicationName = "SimpleUITestApp"; BlobCache.EnsureInitialized(); Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); CustomReturnEntryRenderer.Init(); LoadApplication(App = new App()); }
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); ImageCircle.Forms.Plugin.Droid.ImageCircleRenderer.Init(); Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); global::Xamarin.Forms.FormsMaterial.Init(this, savedInstanceState); FirebaseApp.InitializeApp(this); AndroidAppLinks.Init(this); LoadApplication(new App()); ThemeService.ApplyTheme(GetOSTheme(Resources.Configuration)); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; // Subscribe to Screen Orientation Messages MessagingCenter.Subscribe <object>(this, "Portrait", sender => { RequestedOrientation = ScreenOrientation.Portrait; }); MessagingCenter.Subscribe <object>(this, "Unspecified", sender => { RequestedOrientation = ScreenOrientation.User; }); MessagingCenter.Subscribe <object>(this, "Landscape", sender => { RequestedOrientation = ScreenOrientation.Landscape; }); base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); Xamarin.Essentials.Platform.Init(this, bundle); // App Linking FirebaseApp.InitializeApp(this); AndroidAppLinks.Init(this); LoadApplication(new App()); }
private void InitExternModule(Bundle savedInstanceState) { XF.Material.Droid.Material.Init(this, savedInstanceState); Android.Glide.Forms.Init(this, debug: false); global::Xamarin.Auth.Presenters.XamarinAndroid.AuthenticationConfiguration.Init(this, savedInstanceState); global::Xamarin.Auth.CustomTabsConfiguration.CustomTabsClosingMessage = null; //global::Xamarin.Auth.WebViewConfiguration.Android.UserAgent = "Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Mobile Safari/537.36"; Sharpnado.Presentation.Forms.Droid.SharpnadoInitializer.Initialize(); FFImageLoading.Forms.Platform.CachedImageRenderer.Init(enableFastRenderer: true); FirebaseApp.InitializeApp(this); AndroidAppLinks.Init(this); UserDialogs.Init(this); //NotificationCenter.CreateNotificationChannel(new Plugin.LocalNotification.Platform.Droid.NotificationChannelRequest //{ // Id = AppConfig.Psoe_Noti_Channel_01, // Importance = NotificationImportance.High, // Name = "General", // Description = "General", //}); Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity = this; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); //values are to be referred from downloaded google-services.json file var options = new FirebaseOptions.Builder() .SetApplicationId("<client.client_info.mobilesdk_app_id>") .SetApiKey("<api_key.current_key>") .SetDatabaseUrl("<project_info.firebase_url>") .SetGcmSenderId("<oauth_client.client_id>") .SetStorageBucket("<project_info.storage_bucket>") .Build(); var apps = FirebaseApp.GetApps(this); if (apps.Count == 0)//to avoid exception { FirebaseApp.InitializeApp(this, options); } Xamarin.Forms.Forms.Init(this, bundle); AndroidAppLinks.Init(this); LoadApplication(new App()); }
protected override void OnCreate(Bundle bundle) { try { FormsAppCompatActivity.ToolbarResource = Resource.Layout.Toolbar; FormsAppCompatActivity.TabLayoutResource = Resource.Layout.Tabs; base.OnCreate(bundle); if (Settings.BuginAndroidAutoresize) { this.Window.AddFlags(WindowManagerFlags.Fullscreen); this.Window.AddFlags(WindowManagerFlags.KeepScreenOn); Window.SetSoftInputMode(SoftInput.AdjustResize); if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { // Bug in Android 5+, this is an adequate workaround AndroidBug5497WorkaroundForXamarinAndroid.assistActivity(this, WindowManager); } } if (Settings.TurnFullScreenOn) { this.Window.AddFlags(WindowManagerFlags.Fullscreen); this.Window.AddFlags(WindowManagerFlags.KeepScreenOn); } if (Settings.TurnSecurityProtocolType3072On) { ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; HttpClient client = new HttpClient(new Xamarin.Android.Net.AndroidClientHandler()); } if (Settings.TurnTrustFailureOn_WebException) { //If you are Getting this error >>> System.Net.WebException: Error: TrustFailure /// then Set it to true System.Net.ServicePointManager.ServerCertificateValidationCallback += (o, certificate, chain, errors) => true; System.Security.Cryptography.AesCryptoServiceProvider b = new System.Security.Cryptography.AesCryptoServiceProvider(); } CachedImageRenderer.Init(); var ignore = new CircleTransformation(); var assembliesToInclude = new List <Assembly>() { typeof(CachedImage).GetTypeInfo().Assembly, typeof(CachedImageRenderer).GetTypeInfo().Assembly }; AndroidClipboardManager = (ClipboardManager)GetSystemService(ClipboardService); var container = new SimpleContainer(); container.Register <IDevice>(t => AndroidDevice.CurrentDevice); container.Register <IGeolocator, Geolocator>(); Resolver.ResetResolver(); Resolver.SetResolver(container.GetResolver()); CrossMedia.Current.Initialize(); ImageCircleRenderer.Init(); UserDialogs.Init(this); global::Xamarin.Forms.Forms.Init(this, bundle); AndroidAppLinks.Init(this); var data = Intent?.Data?.EncodedAuthority.ToString(); //Uri data = getIntent().getData(); //String scheme = data.getScheme(); // "http" //String host = data.getHost(); // "twitter.com" //List < String > params = data.getPathSegments(); //String first = params.get(0); // "status" //String second = params.get(1); // "1234" LoadApplication(new App()); } catch (Exception ex) { } }
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); }
protected override void OnCreate(Bundle savedInstanceState) { FormsAppCompatActivity.ToolbarResource = Resource.Layout.toolbar; FormsAppCompatActivity.TabLayoutResource = Resource.Layout.tabs; base.OnCreate(savedInstanceState); MainActivity.current = this; CrossMedia.Current.Initialize(); Forms.Init(this, savedInstanceState); FormsMaps.Init(this, savedInstanceState); AndroidAppLinks.Init(this); Toolkit.Init(); AsNumAssemblyHelper.HoldAssembly(); // Image caching package CachedImageRenderer.Init(); UserDialogs.Init(this); // Check and register Finger Scan if available CheckFingerPrint(); PullToRefreshLayoutRenderer.Init(); https://github.com/jamesmontemagno/Xamarin.Forms-PullToRefreshLayout typeof(Color).GetProperty("Accent", BindingFlags.Public | BindingFlags.Static).SetValue(null, Color.FromHex("#757575")); ImageCircle.Forms.Plugin.Droid.ImageCircleRenderer.Init(); // https://github.com/jamesmontemagno/ImageCirclePlugin // ZXing.Net.Mobile.Forms.Android.Platform.Init(); // https://components.xamarin.com/view/zxing.net.mobile #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; if (gpsAvailable) { client = new GoogleApiClient.Builder(this) // http://stackoverflow.com/questions/33391731/how-to-get-googleapiclient-in-xamarin .AddApi(AppIndex.API) // for app indexing support .Build(); } MessagingService.Current.Subscribe <string>(MessageKeys.LoggedIn, async(m, role) => { RegisterWithGCM(); }); OnNewIntent(Intent); if (!Settings.Current.PushNotificationsEnabled) { return; } #if ENABLE_TEST_CLOUD #else RegisterWithGCM(); #endif DataRefreshService.ScheduleRefresh(this); CheckForUpdates(); //InitlizeSync(); }
protected override void OnCreate(Bundle bundle) { Profile.Start(); ToolbarResource = Resource.Layout.Toolbar; TabLayoutResource = Resource.Layout.Tabbar; // Uncomment the next line to run this as a full screen app (no status bar) //Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.TurnScreenOn); base.OnCreate(bundle); #if !LEGACY_RENDERERS #else Forms.SetFlags("UseLegacyRenderers"); #endif // null out the assembly on the Resource Manager // so all of our tests run without using the reflection APIs // At some point the Resources class types will go away so // reflection will stop working ResourceManager.Init(null); Microsoft.Maui.Controls.Compatibility.Forms.Init(this, bundle); FormsMaps.Init(this, bundle); #if ENABLE_TEST_CLOUD ViewHandler .ViewMapper[nameof(IView.AutomationId)] = (h, v) => { ((global::Android.Views.View)h.NativeView).ContentDescription = v.AutomationId; }; #endif //FormsMaterial.Init(this, bundle); AndroidAppLinks.Init(this); Microsoft.Maui.Controls.Compatibility.Forms.ViewInitialized += (sender, e) => { // if (!string.IsNullOrWhiteSpace(e.View.StyleId)) { // e.NativeView.ContentDescription = e.View.StyleId; // } }; // uncomment to verify turning off title bar works. This is not intended to be dynamic really. //Forms.SetTitleBarVisibility (AndroidTitleBarVisibility.Never); if (RestartAppTest.App != null) { _app = (App)RestartAppTest.App; RestartAppTest.Reinit = true; } else { _app = new App(); } // When the native control gallery loads up, it'll let us know so we can add the nested native controls MessagingCenter.Subscribe <NestedNativeControlGalleryPage>(this, NestedNativeControlGalleryPage.ReadyForNativeControlsMessage, AddNativeControls); // When the native binding gallery loads up, it'll let us know so we can set up the native bindings MessagingCenter.Subscribe <NativeBindingGalleryPage>(this, NativeBindingGalleryPage.ReadyForNativeBindingsMessage, AddNativeBindings); // Listen for the message from the status bar color toggle test MessagingCenter.Subscribe <AndroidStatusBarColor>(this, AndroidStatusBarColor.Message, color => SetStatusBarColor(global::Android.Graphics.Color.Red)); SetUpForceRestartTest(); // Make the activity accessible to platform unit tests DependencyResolver.ResolveUsing((t) => { if (t == typeof(Context)) { return(this); } return(null); }); DependencyService.Register <IMultiWindowService, MultiWindowService>(); LoadApplication(_app); #if LEGACY_RENDERERS if ((int)Build.VERSION.SdkInt >= 21) { // Show a purple status bar if we're looking at legacy renderers Window.SetStatusBarColor(Color.MediumPurple.ToAndroid()); } #endif }
protected override void OnCreate(Bundle bundle) { Profile.Start(); ToolbarResource = Resource.Layout.Toolbar; TabLayoutResource = Resource.Layout.Tabbar; // Uncomment the next line to run this as a full screen app (no status bar) //Window.AddFlags(WindowManagerFlags.Fullscreen | WindowManagerFlags.TurnScreenOn); base.OnCreate(bundle); #if TEST_EXPERIMENTAL_RENDERERS // Fake_Flag is here so we can test for flag initialization issues Forms.SetFlags("Fake_Flag" /*, "CollectionView_Experimental", "Shell_Experimental"*/); #else Forms.SetFlags("UseLegacyRenderers", "SwipeView_Experimental", "MediaElement_Experimental", "AppTheme_Experimental"); #endif Forms.Init(this, bundle); FormsMaps.Init(this, bundle); DualScreen.DualScreenService.Init(this); FormsMaterial.Init(this, bundle); AndroidAppLinks.Init(this); Forms.ViewInitialized += (sender, e) => { // if (!string.IsNullOrWhiteSpace(e.View.StyleId)) { // e.NativeView.ContentDescription = e.View.StyleId; // } }; // uncomment to verify turning off title bar works. This is not intended to be dynamic really. //Forms.SetTitleBarVisibility (AndroidTitleBarVisibility.Never); if (RestartAppTest.App != null) { _app = (App)RestartAppTest.App; RestartAppTest.Reinit = true; } else { _app = new App(); } // When the native control gallery loads up, it'll let us know so we can add the nested native controls MessagingCenter.Subscribe <NestedNativeControlGalleryPage>(this, NestedNativeControlGalleryPage.ReadyForNativeControlsMessage, AddNativeControls); // When the native binding gallery loads up, it'll let us know so we can set up the native bindings MessagingCenter.Subscribe <NativeBindingGalleryPage>(this, NativeBindingGalleryPage.ReadyForNativeBindingsMessage, AddNativeBindings); // Listen for the message from the status bar color toggle test MessagingCenter.Subscribe <AndroidStatusBarColor>(this, AndroidStatusBarColor.Message, color => SetStatusBarColor(global::Android.Graphics.Color.Red)); SetUpForceRestartTest(); // Make the activity accessible to platform unit tests DependencyResolver.ResolveUsing((t) => { if (t == typeof(Context)) { return(this); } return(null); }); LoadApplication(_app); #if !TEST_EXPERIMENTAL_RENDERERS if ((int)Build.VERSION.SdkInt >= 21) { // Show a purple status bar if we're looking at legacy renderers Window.SetStatusBarColor(Color.MediumPurple.ToAndroid()); } #endif }