Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            AppCenter.Start("d9ecfc4b-f729-47c3-9a13-3612f85034d4",
                            typeof(Analytics), typeof(Crashes));

            AppCenter.Start("{Your Xamarin Android App Secret}", typeof(Distribute));
            Distribute.SetEnabledForDebuggableBuild(true);

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

            base.Window.RequestFeature(WindowFeatures.ActionBar);
            // Name of the MainActivity theme you had there before.
            // Or you can use global::Android.Resource.Style.ThemeHoloLight
            base.SetTheme(Resource.Style.MainTheme);


            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            LoadApplication(new App());

            CreateService();
        }
Esempio n. 2
0
        private void ConfigureDataForDistribute(object sender, DistributeTestType distributeTestType)
        {
            var prefs      = GetSharedPreferences("AppCenter", FileCreationMode.Private);
            var prefEditor = prefs.Edit();

            switch (distributeTestType)
            {
            case DistributeTestType.EnableDebuggableBuilds:
                Distribute.SetEnabledForDebuggableBuild(true);
                break;

            case DistributeTestType.FreshInstallAsync:
                prefEditor.PutString("Distribute.request_id", Config.RequestId);
                break;

            case DistributeTestType.CheckUpdateAsync:
                prefEditor.PutString("Distribute.request_id", Config.RequestId);
                prefEditor.PutString("Distribute.update_token", "token");
                prefEditor.PutString("Distribute.distribution_group_id", Config.DistributionGroupId);
                prefEditor.PutString("Distribute.downloaded_release_hash", "hash");
                break;

            case DistributeTestType.Clear:
                prefEditor.Remove("Distribute.request_id");
                prefEditor.Remove("Distribute.update_token");
                prefEditor.Remove("Distribute.distribution_group_id");
                prefEditor.Remove("Distribute.downloaded_release_hash");
                break;

            case DistributeTestType.OnResumeActivity:
                OnResume();
                break;
            }
            prefEditor.Commit();
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;

            TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException;

            Distribute.SetEnabledForDebuggableBuild(true);

            // FFImageLoading Init
            CachedImageRenderer.Init(enableFastRenderer: false);

            CachedImageRenderer.InitImageViewHandler();

            Platform.Init(this, savedInstanceState);

            ////// Init things
            //Xamarin.Forms.Forms.SetFlags(new string[] {
            //    "DragAndDrop_Experimental"
            //    });

            Xamarin.Forms.Forms.Init(this, savedInstanceState);

            // Set Status Bar background to Light or Dark as required
            Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);

            // Load the app
            LoadApplication(new App());
        }
Esempio n. 4
0
        protected override void OnCreate(Bundle bundle)
        {
            // Clear shared preferences before the test.
            var prefs = GetSharedPreferences("AppCenter", FileCreationMode.Private);

            prefs.Edit().Clear();

            // Register tests from shared library.
            AddTestAssembly(typeof(Config).Assembly);

            // Try to send results to the host via a socket for CI.
            try
            {
                ResultChannel = TrxResultChannel.CreateTcpTrxResultChannel(ResultChannelHost, Config.ResultChannelPort).Result;
            }
            catch (Exception e)
            {
                Log.Warn("AppCenterTest", $"Could not connect to host for reporting results.\n{e}");
            }

            // start running the test suites as soon as the application is loaded
            AutoStart = true;

#if !DEBUG
            // crash the application (to ensure it's ended) and return to springboard
            TerminateAfterExecution = true;
#endif
            Distribute.SetEnabledForDebuggableBuild(true);
            DistributeUpdateTest.DistributeEvent += ConfigureDataForDistribute;

            // you cannot add more assemblies once calling base
            base.OnCreate(bundle);
        }
Esempio n. 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            //Show content behind status bar
            Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.LayoutFullscreen | (StatusBarVisibility)SystemUiFlags.LayoutStable;

            //FFImageLoading.Svg.Forms
            CachedImageRenderer.Init(true);
            var ignore = typeof(SvgCachedImage);

            //App Center
            Distribute.SetEnabledForDebuggableBuild(true);
            Distribute.UpdateTrack = UpdateTrack.Private;
            AppCenter.Start("ac728f87-3efb-410c-a98b-ff612f259ff8",
                            typeof(Analytics), typeof(Crashes), typeof(Distribute));

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

            //MSAL
            App.UIParent = this;
        }
Esempio n. 6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            System.Diagnostics.Debug.WriteLine("Android_OnCreate");
            Distribute.SetEnabledForDebuggableBuild(true);
            base.OnCreate(savedInstanceState);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            Distribute.SetEnabledForDebuggableBuild(true);
            LoadApplication(new App());
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
            Plugin.InputKit.Platforms.Droid.Config.Init(this, savedInstanceState);
            CachedImageRenderer.Init(true);
            global::Xamarin.Forms.Forms.SetFlags("Shell_Experimental", "Visual_Experimental", "CollectionView_Experimental", "FastRenderers_Experimental");
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            Distribute.SetEnabledForDebuggableBuild(true);
            LoadApplication(new App());
        }
Esempio n. 9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            //TabLayoutResource = Resource.Layout.Tabbar;
            //ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;

            TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException;

            // Get read/write permisions
            if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) != (int)Permission.Granted)
            {
                ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.WriteExternalStorage }, 0);
            }

            if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) != (int)Permission.Granted)
            {
                ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.ReadExternalStorage }, 0);
            }

            // Init things
            Xamarin.Forms.Forms.SetFlags(new string[] {
                "AppTheme_Experimental",
                "MediaElement_Experimental",
                "RadioButton_Experimental",
                "Shell_UWP_Experimental"
            });

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

            CrossCurrentActivity.Current.Init(this, savedInstanceState);

            // App Center Distribute
            Distribute.SetEnabledForDebuggableBuild(true);

            // FFImageLoading Init
            CachedImageRenderer.Init(enableFastRenderer: false);

            CachedImageRenderer.InitImageViewHandler();

            Platform.Init(this, savedInstanceState);

            // Load the app
            LoadApplication(new App(new AndroidInitializer()));
        }
Esempio n. 10
0
        protected override void OnCreate(Bundle savedInstanceState)

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

            base.OnCreate(savedInstanceState);

            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;

            TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException;

            // Get read/write permisions
            if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.WriteExternalStorage) != (int)Permission.Granted)
            {
                ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.WriteExternalStorage }, 0);
            }

            if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadExternalStorage) != (int)Permission.Granted)
            {
                ActivityCompat.RequestPermissions(this, new string[] { Manifest.Permission.ReadExternalStorage }, 0);
            }

            // Init things
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            CrossCurrentActivity.Current.Init(this, savedInstanceState);

            // App Center Distribute
            Distribute.SetEnabledForDebuggableBuild(true);

            // FFImageLoading Init
            CachedImageRenderer.Init(enableFastRenderer: false);

            CachedImageRenderer.InitImageViewHandler();

            Platform.Init(this, savedInstanceState);

            ScreenHelper screenHelper = new ScreenHelper();
            bool         isDuo        = screenHelper.Initialize(this);

            //GrampsView.UserControls.Droid.Renderers.BorderlessEntryRenderer.Init();

            // Load the app
            LoadApplication(new App(new AndroidInitializer()));
        }
Esempio n. 11
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     CrossCurrentActivity.Current.Init(this, savedInstanceState);
     TabLayoutResource = Resource.Layout.Tabbar;
     ToolbarResource   = Resource.Layout.Toolbar;
     Distribute.SetEnabledForDebuggableBuild(true);
     //Distribute.DisableAutomaticCheckForUpdate();
     AppCenter.Start("a094357a-a18c-417d-9eaf-59fe66a81b46", typeof(Analytics), typeof(Crashes), typeof(Distribute));
     base.OnCreate(savedInstanceState);
     this.Window.SetStatusBarColor(Android.Graphics.Color.Transparent);
     this.Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges;
     this.Window.AddFlags(WindowManagerFlags.Fullscreen);
     this.Window.AddFlags(WindowManagerFlags.LayoutInOverscan);
     Xamarin.Essentials.Platform.Init(this, savedInstanceState);
     global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
     LoadApplication(new App());
 }
Esempio n. 12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            var theme = Xamarin.Essentials.Preferences.Get(Constants.AppThemePreferenceKey, false);

            SetTheme(theme ? Resource.Style.MainDarkTheme : Resource.Style.MainTheme);

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;
            base.OnCreate(savedInstanceState);
            CrossCurrentActivity.Current.Init(this, savedInstanceState);
            Rg.Plugins.Popup.Popup.Init(this, savedInstanceState);
            Distribute.SetEnabledForDebuggableBuild(true);
            global::Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            XamEffects.Droid.Effects.Init();
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            global::Xamarin.Forms.FormsMaterial.Init(this, savedInstanceState);
            UserDialogs.Init(() => this);
            LoadApplication(new App());
        }
Esempio n. 13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            Distribute.SetEnabledForDebuggableBuild(true);
            Distribute.ReleaseAvailable = OnReleaseAvailable;

            AppCenter.Start("d168a2d9-5eac-47d4-a48c-551b57ade262",
                            typeof(Analytics), typeof(Crashes), typeof(Distribute));


            base.OnCreate(savedInstanceState);

            Rg.Plugins.Popup.Popup.Init(this, savedInstanceState);
            Plugin.InputKit.Platforms.Droid.Config.Init(this, savedInstanceState);

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

            LoadApplication(new App());
        }
Esempio n. 14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;
            base.OnCreate(savedInstanceState);

            if (Intent.Extras != null)
            {
                foreach (var key in Intent.Extras.KeySet())
                {
                    if (key != null)
                    {
                        var value = Intent.Extras.GetString(key);
                        Log.Debug(TAG, "Key: {0} Value: {1}", key, value);
                    }
                }
            }

            CreateNotificationChannel();

            UserDialogs.Init(this);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            StatesButtonRenderer.Init();
            Distribute.SetEnabledForDebuggableBuild(true);

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

            IsPlayServicesAvailable();

            Task.Run(() =>
            {
                FirebaseInstanceId.Instance.DeleteInstanceId();
                Console.WriteLine($"Force token: {FirebaseInstanceId.Instance.Token}");
            });
        }
Esempio n. 15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;

            TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException;



            // Init things
            Xamarin.Forms.Forms.SetFlags(new string[] {
                "AppTheme_Experimental",
                "DragAndDrop_Experimental",
                "MediaElement_Experimental",
                "RadioButton_Experimental",
                "Shell_UWP_Experimental"
            });

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



            // App Center Distribute
            Distribute.SetEnabledForDebuggableBuild(true);

            // FFImageLoading Init
            CachedImageRenderer.Init(enableFastRenderer: false);

            CachedImageRenderer.InitImageViewHandler();

            Platform.Init(this, savedInstanceState);

            // Load the app
            LoadApplication(new App(new AndroidInitializer()));
        }
Esempio n. 16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource

            //SupportActionBar.Hide();  // If you want to hide app bar
            SetContentView(Resource.Layout.layout_main);

            Distribute.SetEnabledForDebuggableBuild(true);
            AppCenter.Start("7bba33fe-411e-42d9-ba2c-e5cad04df867", typeof(Distribute));

            ImageButton btnScan    = FindViewById <ImageButton>(Resource.Id.btnMainScan);
            ImageButton btnReports = FindViewById <ImageButton>(Resource.Id.btnMainReports);
            ImageButton btnFindSKU = FindViewById <ImageButton>(Resource.Id.btnMainFindSKU);

            ImageButton btnLastMarkdown = FindViewById <ImageButton>(Resource.Id.btnMainLastMD);
            ImageButton btnSettings     = FindViewById <ImageButton>(Resource.Id.btnMainSettings);
            ImageButton btnWHS          = FindViewById <ImageButton>(Resource.Id.btnMainWHS);

            TextView  txtAppVersion  = FindViewById <TextView>(Resource.Id.txtAppVersion);
            TextView  txtDateTime    = FindViewById <TextView>(Resource.Id.txtMainDateTime);
            ImageView imgWifiWarning = FindViewById <ImageView>(Resource.Id.imgMainWifiWarning);
            TextView  txtWifiWarning = FindViewById <TextView>(Resource.Id.txtMainWifiWarning);

            databaseOK = CreateDBTables();

            txtAppVersion.Text = "(app version: 1." + Constants.CurrentVersion + ")";
            txtDateTime.Text   = DateTime.Now.ToLongDateString() + "  " + DateTime.Now.ToShortTimeString();

            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Interval = 3000;
            timer.Elapsed += Timer_Elapsed;
            timer.Enabled  = true;
            timer.Start();

            OpenRFIDConnection();

            btnScan.Click         += BtnScan_Click;
            btnReports.Click      += BtnReports_Click;
            btnFindSKU.Click      += BtnFindSKU_Click;
            btnLastMarkdown.Click += BtnLastMarkdown_Click;
            btnSettings.Click     += BtnSettings_Click;
            btnWHS.Click          += BtnWHS_Click;

            UpdateWifiStatus();

            if ((databaseOK) && (wifiConnected))
            {
                DisplayScannerRegistration();

                ThreadPool.QueueUserWorkItem(state =>
                {
                    ImportStoreInfo();
                });

                // =======================================================
                // *If an update wipes out Registration record, try to
                //  look it up (by TC20 serial) on S-WHS and do a silent re-reg
                // =======================================================

                if (scannerID == 0)
                {
                    ImportRegistrationRecordFromWHS();
                }
            }
        } // OnCreate()
Esempio n. 17
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            // Get the ViewPager and set it's PagerAdapter so that it can display items
            var viewPager = FindViewById(Resource.Id.viewpager) as ViewPager;

            viewPager.Adapter = new PagerAdapter(SupportFragmentManager, this);

            // Give the TabLayout the ViewPager
            var tabLayout = FindViewById(Resource.Id.tablayout) as TabLayout;

            tabLayout.SetupWithViewPager(viewPager);

            // App Center integration
            AppCenterLog.Assert(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel);
            AppCenter.LogLevel = LogLevel.Verbose;
            AppCenterLog.Info(LogTag, "AppCenter.LogLevel=" + AppCenter.LogLevel);
            AppCenterLog.Info(LogTag, "AppCenter.Configured=" + AppCenter.Configured);

            // Set event handlers
            Crashes.SendingErrorReport      += SendingErrorReportHandler;
            Crashes.SentErrorReport         += SentErrorReportHandler;
            Crashes.FailedToSendErrorReport += FailedToSendErrorReportHandler;

            // Set callbacks
            Crashes.ShouldProcessErrorReport    = ShouldProcess;
            Crashes.ShouldAwaitUserConfirmation = ConfirmationHandler;

            Distribute.ReleaseAvailable = OnReleaseAvailable;
            AppCenterLog.Assert(LogTag, "AppCenter.Configured=" + AppCenter.Configured);
            AppCenter.SetLogUrl("https://in-integration.dev.avalanch.es");
            Distribute.SetInstallUrl("https://install.portal-server-core-integration.dev.avalanch.es");
            Distribute.SetApiUrl("https://asgard-int.trafficmanager.net/api/v0.1");
            Distribute.SetEnabledForDebuggableBuild(true);

            // Enable Firebase Analytics if set
            var enableAnalytics = Preferences.SharedPreferences.GetBoolean(Constants.FirebaseAnalyticsEnabledKey, false);

            if (enableAnalytics)
            {
                Push.EnableFirebaseAnalytics();
            }

            Push.PushNotificationReceived += PrintNotification;

            AppCenter.Start("bff0949b-7970-439d-9745-92cdc59b10fe", typeof(Analytics), typeof(Crashes),
                            typeof(Push), typeof(Distribute));

            AppCenter.IsEnabledAsync().ContinueWith(enabled =>
            {
                AppCenterLog.Info(LogTag, "AppCenter.Enabled=" + enabled.Result);
            });
            AppCenter.GetInstallIdAsync().ContinueWith(installId =>
            {
                AppCenterLog.Info(LogTag, "AppCenter.InstallId=" + installId.Result);
            });
            Crashes.HasCrashedInLastSessionAsync().ContinueWith(hasCrashed =>
            {
                AppCenterLog.Info(LogTag, "Crashes.HasCrashedInLastSession=" + hasCrashed.Result);
            });
            Crashes.GetLastSessionCrashReportAsync().ContinueWith(report =>
            {
                AppCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Exception=" + report.Result?.Exception);
                AppCenterLog.Info(LogTag, "Crashes.LastSessionCrashReport.Throwable=" + report.Result?.AndroidDetails?.Throwable);
            });
        }