Beispiel #1
0
        protected override void OnCreate(Bundle bundle)
        {
            ServicePointManager
            .ServerCertificateValidationCallback +=
                (sender, cert, chain, sslPolicyErrors) => true;

            Insights.HasPendingCrashReport += (sender, isStartupCrash) => {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };
            Insights.Initialize("d1b792655ba13200116b009b175104c32487cc25", ApplicationContext);

            base.OnCreate(bundle);

            var metrics = Resources.DisplayMetrics;

            App.ScreenWidth  = ConvertPixelsToDp(metrics.WidthPixels);
            App.ScreenHeight = ConvertPixelsToDp(metrics.HeightPixels);

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

            LoadApplication(new App());
        }
Beispiel #2
0
        public static void Initialize(IInsightsInitializer initializer, string insightsKey, bool suppressException = true)
        {
            if (string.IsNullOrWhiteSpace(insightsKey))
            {
                return;
            }

            try
            {
                // see https://developer.xamarin.com/guides/insights/platform-features/advanced-topics/dealing-with-startup-crashes/
                Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
                {
                    if (isStartupCrash)
                    {
                        Insights.PurgePendingCrashReports().Wait();
                    }
                };

                initializer.Initialize(insightsKey);
            }
            catch
            {
                // If we fail to setup our error report code no reason to throw an exception we'll never see. Godspeed user.
                if (!suppressException)
                {
                    throw;
                }
            }
        }
Beispiel #3
0
 static void PurgeCrashReports(object sender, bool isStartupCrash)
 {
     if (isStartupCrash)
     {
         Insights.PurgePendingCrashReports().Wait();
     }
 }
Beispiel #4
0
        //TODO: The commented out code is related to the orientation stuff
        //public override void OnConfigurationChanged(global::Android.Content.Res.Configuration newConfig)
        //{
        //    base.OnConfigurationChanged(newConfig);
        //    DeviceOrientationImplementation.NotifyOrientationChange(newConfig);
        //}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Insights.HasPendingCrashReport += (sender, isStartupCrash)
                                              =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };
            Insights.Initialize("c3073d3e8d28a2b889bdd692f98ece61abfb3090", Application.Context);

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

            #region Old Code Related to Device Orientation
            //DeviceOrientationImplementation.Init();
            // Locks the device into portrait mode
            //if (Device.Idiom == TargetIdiom.Phone)
            //{
            //    this.RequestedOrientation = ScreenOrientation.SensorPortrait;
            //}
            #endregion

            LoadApplication(new App());
        }
Beispiel #5
0
        public override void DidFinishLaunching(NSNotification notification)
        {
            /*
             * new System.Threading.Thread (() =>
             *      {
             *              while (true) {
             *                      System.Threading.Thread.Sleep (1000);
             *                      Debug("GC.Collect: " + DateTime.Now.ToString());
             *                      GC.Collect ();
             *              }
             *      }).Start ();
             */

            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };

            Insights.Initialize("39819b4f3c0a9fbe38391c6413f6a9d48e0d6cd5", "1.0", "Disk Reporter");

            mainWindowController = new MainWindowController();
            mainWindowController.Window.MakeKeyAndOrderFront(this);
        }
Beispiel #6
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                Insights.Initialize(InsightsConstants.InsightsApiKey);

                Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
                {
                    if (isStartupCrash)
                    {
                        Insights.PurgePendingCrashReports().GetAwaiter().GetResult();
                    }
                };

                Xamarin.Forms.Forms.Init(e);
                EntryCustomReturn.Forms.Plugin.UWP.CustomReturnEntryRenderer.Init();

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }
        }
Beispiel #7
0
 static void Main(string[] args)
 {
     Insights.HasPendingCrashReport += (sender, isStartupCrash) => {
         if (isStartupCrash)
         {
             Insights.PurgePendingCrashReports().Wait();
         }
     };
     Insights.Initialize("d1b792655ba13200116b009b175104c32487cc25");
     UIApplication.Main(args, null, "AppDelegate");
 }
        void InitXamarinInsight(IContextService contextService, IMobileConfigurationManager configService)
        {
            Insights.Initialize(configService.MobileConfigurationFile.XamarinInsightKey, ((Context)contextService.GetContext()));

            Insights.HasPendingCrashReport += async(sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    await Insights.PurgePendingCrashReports();
                }
            };
        }
        void SetupInsight()
        {
            Insights.Initialize(Keys.XAMARIN_INSIGHT_KEY, AppContext);

            Insights.HasPendingCrashReport += async(sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    await Insights.PurgePendingCrashReports();
                }
            };
        }
Beispiel #10
0
        //Insights only for release version

        void ConfigureInsights()
        {
            Insights.Initialize(Configuration.InsightsApiKey);


            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };
        }
Beispiel #11
0
        public override void OnCreate()
        {
            base.OnCreate();

            Insights.Initialize(Insights_Constants.INSIGHTS_API_KEY, this);

            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };
        }
Beispiel #12
0
        // This is the main entry point of the application.
        static void Main(string[] args)
        {
            Insights.Initialize(InsightsConstants.InsightsAPIKey);

            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };

            UIApplication.Main(args, null, "AppDelegate");
        }
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };
            Insights.Initialize("54438324c5a009a3647a530de408bd26905780b7");
            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
        void Initialize()
        {
            if (!Insights.IsInitialized)
            {
                Insights.Initialize(InsightsAPIKey);

                Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
                {
                    if (isStartupCrash)
                    {
                        Task.Run(async() => await Insights.PurgePendingCrashReports()).ConfigureAwait(false);
                    }
                };
            }
        }
Beispiel #15
0
        public override void OnCreate()
        {
            base.OnCreate();
            RegisterActivityLifecycleCallbacks(this);

            Insights.Initialize(InsightsConstants.InsightsApiKey, this);

            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };
        }
Beispiel #16
0
 // This is the main entry point of the application.
 static void Main(string[] args)
 {
     Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
     {
         if (isStartupCrash)
         {
             Insights.PurgePendingCrashReports().Wait();
         }
     };
     Insights.Initialize("326d0dddbabfe133f26293d8c82f4f25113ddc7f");
     // if you want to use a different Application Delegate class from "AppDelegate"
     // you can specify it here.
     UIApplication.Main(args, null, "AppDelegate");
     AdvancedTimer.Forms.Plugin.iOS.AdvancedTimerImplementation.Init();
 }
Beispiel #17
0
        void ConfigureInsights()
        {
                        #if DEBUG
            Insights.Initialize(Insights.DebugModeKey);
                        #else
            Insights.Initialize("2c20bceca57690c4e1696a98faa68cef19795dc7");
                        #endif

            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };
        }
        // This is the main entry point of the application.
        static void Main(string[] args)
        {
            Insights.Initialize(Insights_Constants.INSIGHTS_API_KEY);

            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };

            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            UIApplication.Main(args, null, "AppDelegate");
        }
Beispiel #19
0
        protected override void OnCreate(Bundle bundle)
        {
            Insights.HasPendingCrashReport += (sender, isStartUpCrash) =>
            {
                if (isStartUpCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };

            Insights.Initialize("d8cab994e1e4126f4c950fb592392ac59fc74ac0", ApplicationContext);

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
        }
        protected override void OnCreate(Bundle bundle)
        {
            Insights.Initialize(InsightsConstants.InsightsAPIKey, this);

            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };

            base.OnCreate(bundle);

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

            LoadApplication(new App());
        }
Beispiel #21
0
        protected override void OnCreate(Bundle bundle)
        {
            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };
            Insights.Initialize("326d0dddbabfe133f26293d8c82f4f25113ddc7f", ApplicationContext);

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            AdvancedTimer.Forms.Plugin.Droid.AdvancedTimerImplementation.Init();


            LoadApplication(new App());
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Insights.Initialize(InsightsConstants.InsightsAPIKey, this);

            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().GetAwaiter().GetResult();
                }
            };

            base.OnCreate(savedInstanceState);

            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            EntryCustomReturn.Forms.Plugin.Android.CustomReturnEntryRenderer.Init();

            LoadApplication(new App());
        }
Beispiel #23
0
        public SalesApplication(IntPtr handle, JniHandleOwnership transfer) : base(handle, transfer)
        {
            Instance = this;

            // Set up Xamarin Insights
            // first configure attempt to catch start-up exceptions
            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };

            // now configure different keys for
            #if DEBUG
            Insights.Initialize(Insights.DebugModeKey, this);
            #elif UAT
            Insights.Initialize(Settings.Instance.InsightsDebugApiKey, this);
            #elif STAGING
            Insights.Initialize(Settings.Instance.InsightsDebugApiKey, this);
            #else
            Insights.Initialize(Settings.Instance.InsightsProductionApiKey, this);
            #endif

            //set up global exception handler to log app crashes
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            // Bootstrap the application, load all needed components
            new AndroidBootstrapper().Bootstrap();

            // set up global exception handler to log app crashes
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            // retrieve the logger
            _log = LogManager.Get(typeof(SalesApplication));
            _log.Verbose("Starting application, initialized logger.");

            AsyncHelper.RunSync(async() => await this.ManageDbVersion());

            SetAppLanguage();
        }
Beispiel #24
0
        // This is the main entry point of the application.
        static void Main(string[] args)
        {
            //#if DEBUG
            //   Insights.Initialize (Insights.DebugModeKey);
            //#else
            //   Xamarin.Insights.Initialize ("37f8347b1aa3979ce023e220274aa739d6ea73ba");
            //#endif

            Xamarin.Insights.Initialize("37f8347b1aa3979ce023e220274aa739d6ea73ba");

            Insights.HasPendingCrashReport += (sender, isStartupCrash) => {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };
            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            UIApplication.Main(args, null, "AppDelegate");
        }
Beispiel #25
0
        public override void OnCreate()
        {
            base.OnCreate();
            RegisterActivityLifecycleCallbacks(this);
            //A great place to initialize Xamarin.Insights and Dependency Services!

            // Xamarin insights
            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };
            Insights.Initialize(ConfigurationManager.AppSettings.XamarinInsightsApiKey, this);

            // Initialize
            Appstart.Initialize();

            ParseInitializer.Initialize();
        }
Beispiel #26
0
        // This is the main entry point of the application.
        static void Main(string[] args)
        {
            Insights.Initialize("9b788dbd140e44c0d3ae231e9bd93e82a9515c1a");

            Insights.HasPendingCrashReport += (sender, isStartupCrash) => {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };


            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            try {
                UIApplication.Main(args, null, "AppDelegate");
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            } catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #27
0
        public void UnhandledException(Exception aException)
        {
            bool firstException = !iErrorThrown;

            lock (iLock)
            {
                if (!iErrorThrown)
                {
                    iErrorThrown = true;

                    // create and dump the crash log
                    CrashLog cl = new CrashLog(aException, iOptionManager);
                    foreach (ICrashLogDumper d in iCrashLogDumpers)
                    {
                        d.Dump(cl);
                    }

                    if (Insights.IsInitialized)
                    {
                        var data = new Dictionary <string, string> {
                            { "Logs", UserLog.Text }
                        };
                        string options = string.Empty;
                        foreach (var o in iOptionManager.OptionValues)
                        {
                            options += string.Format("{0} : {1}\n", o.Key, o.Value);
                        }
                        data.Add("Options", options);
                        Insights.Report(aException, data, Xamarin.Insights.Severity.Error);
                        Insights.PurgePendingCrashReports().Wait();
                    }
                }
            }

            // notify
            if (firstException && EventErrorOccurred != null)
            {
                EventErrorOccurred(this, EventArgs.Empty);
            }
        }
Beispiel #28
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // Xamarin insights
            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };
            Insights.Initialize(ConfigurationManager.AppSettings.XamarinInsightsApiKey);

            TestFairy.Begin(ConfigurationManager.AppSettings.TestFairyAppToken);

            // Initialize
            Appstart.Initialize();
            ParseInitializer.Initialize();
            ParsePushInitialize();

            if (ParseUser.CurrentUser != null)
            {
                TestFairy.SetCorrelationId(ParseUser.CurrentUser.Email);
            }

            Xamarin.Forms.Forms.Init();
            Xamarin.FormsMaps.Init();

            LoadApplication(new App());

            // Newer version of Xamarin Studio and Visual Studio provide the
            // ENABLE_TEST_CLOUD compiler directive in the Debug configuration,
            // but not the Release configuration.
#if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
#endif

            return(base.FinishedLaunching(app, options));
        }
        protected override void OnCreate(Bundle bundle)
        {
            Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
            {
                if (isStartupCrash)
                {
                    Insights.PurgePendingCrashReports().Wait();
                }
            };

            Insights.Initialize("29250715aa954d3ceb31ff2d01c1cc194d0e2dd6", ApplicationContext);

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
            //AppUI.Init((IAuthenticate)this);

            //Tar bort den blåa xamarinikonen (gör den transparent)
            ActionBar.SetIcon(new ColorDrawable(Resources.GetColor(Android.Resource.Color.Transparent)));

            LoadApplication(new App());
        }
        protected SensusServiceHelper()
        {
            if (SINGLETON != null)
            {
                throw new SensusException("Attempted to construct new service helper when singleton already existed.");
            }

            _stopped              = true;
            _registeredProtocols  = new ObservableCollection <Protocol>();
            _runningProtocolIds   = new List <string>();
            _healthTestCallbackId = null;
            _idCallback           = new Dictionary <string, ScheduledCallback>();
            _hasher           = new SHA256Managed();
            _pointsOfInterest = new List <PointOfInterest>();

            if (!Directory.Exists(SHARE_DIRECTORY))
            {
                Directory.CreateDirectory(SHARE_DIRECTORY);
            }

            #if DEBUG
            LoggingLevel loggingLevel = LoggingLevel.Debug;
            #elif RELEASE
            LoggingLevel loggingLevel = LoggingLevel.Normal;
            #else
            #error "Unrecognized configuration."
            #endif

            _logger = new Logger(LOG_PATH, loggingLevel, Console.Error);
            _logger.Log("Log file started at \"" + LOG_PATH + "\".", LoggingLevel.Normal, GetType());

            GpsReceiver.Get().Initialize(Geolocator);  // initialize GPS receiver with platform-specific geolocator

            if (Insights.IsInitialized)
            {
                _logger.Log("Xamarin Insights is already initialized.", LoggingLevel.Normal, GetType());
            }
            else if (string.IsNullOrWhiteSpace(XAMARIN_INSIGHTS_APP_KEY))
            {
                _logger.Log("Xamarin Insights API key is empty. Not initializing.", LoggingLevel.Normal, GetType());  // xamarin allows to initialize with a null key, which fails with exception but results in IsInitialized being true. prevent that here.
            }
            else
            {
                try
                {
                    _logger.Log("Initializing Xamarin Insights.", LoggingLevel.Normal, GetType());

                    // wait for startup crash to be logged -- https://insights.xamarin.com/docs
                    Insights.HasPendingCrashReport += (sender, isStartupCrash) =>
                    {
                        if (isStartupCrash)
                        {
                            Insights.PurgePendingCrashReports().Wait();
                        }
                    };

                    InitializeXamarinInsights();
                }
                catch (Exception ex)
                {
                    _logger.Log("Failed to initialize Xamarin insights:  " + ex.Message, LoggingLevel.Normal, GetType());
                }
            }
        }