protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Localytics.RegisterPush("YOUR_GCM_PROJECT_NUMBER"); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); LocalyticsAutoIntegrateApplication.localyticsXamarin.CustomerId = "ms_test_user"; // Register Push Localytics.RegisterPush(); //"YOUR_GCM_PROJECT_NUMBER"); Localytics.SetOption("session_timeout", 1); // Shorten for testing purpose only Button tagEventButton = FindViewById <Button>(Resource.Id.tagEventButton); tagEventButton.Click += delegate { LocalyticsAutoIntegrateApplication.localyticsXamarin.TagEvent("MessagingSample Click"); Localytics.Upload(); }; Button showRegistrationIdButton = FindViewById <Button>(Resource.Id.showRegistrationId); showRegistrationIdButton.Click += delegate { // Blocking Getters may need to be threaded out ThreadPool.QueueUserWorkItem(delegate { TextView pushText = FindViewById <TextView>(Resource.Id.pushText); string pushRegId = Localytics.PushRegistrationId; // Update UI back on UI Thread RunOnUiThread(() => { pushText.Text = pushRegId; }); }); }; Button openInboxButton = FindViewById <Button>(Resource.Id.openInbox); openInboxButton.Click += delegate { StartActivity(typeof(InboxActivity)); }; Button startPlacesButton = FindViewById <Button>(Resource.Id.startPlaces); startPlacesButton.Click += delegate { if ((int)Build.VERSION.SdkInt < 23) { Localytics.SetLocationMonitoringEnabled(true); } else { const string permission = Manifest.Permission.AccessFineLocation; if (ActivityCompat.CheckSelfPermission(this, permission) == (int)Permission.Granted) { Localytics.SetLocationMonitoringEnabled(true); } else { ActivityCompat.RequestPermissions(this, PermissionsLocation, RequestLocationId); } } }; }