private void StartGeofencePlugin() { CrossGeofence.Initialize <GeofenceListenerService>(); CrossGeofence.GeofenceListener.OnAppStarted(); StartService(); }
/// <summary> /// Finisheds the launching. /// </summary> /// <returns><c>true</c>, if launching was finisheded, <c>false</c> otherwise.</returns> /// <param name="uiApplication">User interface application.</param> /// <param name="launchOptions">Launch options.</param> public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions) { Forms.Init(); // http://forums.xamarin.com/discussion/21148/calabash-and-xamarin-forms-what-am-i-missing Forms.ViewInitialized += (sender, e) => { // http://developer.xamarin.com/recipes/testcloud/set-accessibilityidentifier-ios/ if (null != e.View.StyleId) { e.NativeView.AccessibilityIdentifier = e.View.StyleId; } }; FormsMaps.Init(); // Code for starting up the Xamarin Test Cloud Agent #if ENABLE_TEST_CLOUD Calabash.Start(); #endif CrossGeofence.Initialize <CrossGeofenceListener>(); this.LoadApplication(new App()); return(base.FinishedLaunching(uiApplication, launchOptions)); }
// // 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(); LoadApplication(new App()); CrossGeofence.Initialize <CrossGeofenceListener>(); return(base.FinishedLaunching(app, options)); }
// // 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(); LoadApplication(new App(new iOSInitializer())); // Initilize the geofence, much easier than on android // URL to this Plugin's Documentation: https://github.com/CrossGeeks/GeofencePlugin CrossGeofence.Initialize <CrossGeofenceListener>(); return(base.FinishedLaunching(app, options)); }
// // 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.SetFlags("Shell_Experimental", "Visual_Experimental", "CollectionView_Experimental", "FastRenderers_Experimental"); global::Xamarin.Forms.Forms.Init(); Xamarin.FormsMaps.Init(); //Initialization of MapView LoadApplication(new App()); //Initialization of geofence listener service CrossGeofence.Initialize <GeofenceListenerService>(); return(base.FinishedLaunching(app, options)); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); CrossGeofence.Initialize <CrossGeofenceListener>(); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); }
public override void OnCreate() { base.OnCreate(); AppContext = this.ApplicationContext; //TODO: Initialize CrossGeofence Plugin //TODO: Specify the listener class implementing IGeofenceListener interface in the Initialize generic CrossGeofence.Initialize <CrossGeofenceListener>(); //CrossGeofence.GeofenceListener.OnAppStarted(); //Start a sticky service to keep receiving geofence events when app is closed. StartService(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); Xamarin.FormsMaps.Init(this, bundle); CrossGeofence.Initialize <CrossGeofenceListener>(); LoadApplication(new App()); // Initialize OneSignal OneSignal.StartInit("443e79c9-a079-44c0-8b0c-0ae41fa21db9", "914546316019").EndInit(); }
/// <summary> /// Raises the create event. /// </summary> /// <param name="savedInstanceState">Saved instance state.</param> protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if ((int)Build.VERSION.SdkInt >= 23) { Log.Error(Tag, "Version 23"); System.Console.Error.WriteLine("Version 23"); const string StringPermission = Manifest.Permission.AccessFineLocation; if (Android.Support.V4.Content.ContextCompat.CheckSelfPermission(Android.App.Application.Context, StringPermission) == Permission.Denied) { if (ActivityCompat.ShouldShowRequestPermissionRationale(this, StringPermission)) { Snackbar.Make( this.FindViewById(Android.Resource.Id.Content), "Location access is required to show coffee shops nearby.", Snackbar.LengthIndefinite) .SetAction("OK", v => ActivityCompat.RequestPermissions(this, this.permissionsLocation, RequestLocationId)) .Show(); } else { ActivityCompat.RequestPermissions(this, this.permissionsLocation, RequestLocationId); } } } else { System.Console.Error.WriteLine("Version <23"); Log.Error(Tag, "Version < 23"); } CrossGeofence.Initialize <CrossGeofenceListener>(); Forms.Init(this, savedInstanceState); FormsMaps.Init(this, savedInstanceState); // http://forums.xamarin.com/discussion/21148/calabash-and-xamarin-forms-what-am-i-missing Forms.ViewInitialized += (sender, e) => { if (!string.IsNullOrWhiteSpace(e.View.StyleId)) { e.NativeView.ContentDescription = e.View.StyleId; } }; this.LoadApplication(new App()); }
//public async Task TriggerAsync() //{ // TimeSpan lastMeasurement = DateTime.Now.TimeOfDay; // int lap = 0; // while (raceGoing) // { // if (!await CheckIfPassed()) // { // lblPassed.Text = "Did not pass"; // } // else if ((lastMeasurement + TimeSpan.FromSeconds(10)) <= DateTime.Now.TimeOfDay) // { // lastMeasurement = DateTime.Now.TimeOfDay; // lap++; // lblPassed.Text = $"Line passed"; // lblLap.Text = $"Crossed point: {lap} times"; // lblTimeOfLap.Text = $"{lastMeasurement}"; // } // else // { // lblPassed.Text = "we zimme aant wachten"; // } // } //} //public async Task TriggerAsync() //{ // int lap = 0; // DateTime lastMeasurement = DateTime.Now; // while (raceGoing) // { // if (!await CheckIfPassed()) // { // lblPassed.Text = "Did not pass line"; // } // else // { // if(lastMeasurement.AddSeconds(10) < DateTime.Now) // { // lap++; // lblPassed.Text = $"Line passed"; // lblLap.Text = $"Crossed point: {lap} times"; // lastMeasurement = DateTime.Now; // } // } // } //} public async Task TriggerAsync() { //GeofenceCircularRegion P1 = new GeofenceCircularRegion("Point1", 50.91526320925043, 3.651294345010419, 3); //GeofenceCircularRegion P2 = new GeofenceCircularRegion("Point2", 50.91524376217434, 3.6511924210694904, 3); //GeofenceCircularRegion P3 = new GeofenceCircularRegion("Point3", 50.915230233768796, 3.651101896516691, 3); //List<GeofenceCircularRegion> Regions = new List<GeofenceCircularRegion> { P1, P2, P3 }; CrossGeofence.Initialize <CrossGeofenceListener>(); CrossGeofence.GeofencePriority = GeofencePriority.HighAccuracy; CrossGeofence.RequestLocationPermission = true; CrossGeofence.RequestNotificationPermission = true; CrossGeofence.Current.StartMonitoring(new GeofenceCircularRegion("TestPoint", 50.9150914, 3.6513881, 0.5) { ShowEntryNotification = true, NotificationEntryMessage = "entered line", ShowStayNotification = true, NotificationStayMessage = "je bent er nog", StayedInThresholdDuration = TimeSpan.FromSeconds(10) }); }