public async Task TestMParticleStartCorrectOptionsAsync() { await ExecuteOnUIThread(async() => { await MParticle.StartAsync ( MParticleOptions.Builder("foo", "bar").Build() ); }); Assert.IsNotNull(MParticle.Instance); }
public async Task TestLogEventAsync() { await ExecuteOnUIThread(async() => { await MParticle.StartAsync ( MParticleOptions.Builder("foo", "bar").Build() ); }); CustomEvent customEvent = CustomEvent.Builder("foo").Build(); MParticle.Instance.LogEvent(customEvent); }
public async Task TestMParticleStartNoOptionsAsync() { Exception e = null; await ExecuteOnUIThread(async() => { try { await MParticle.StartAsync(null); } catch (Exception ex) { e = ex; } }); Assert.IsNotNull(e); Assert.AreEqual(typeof(InvalidOperationException), e.GetType()); }
protected override void OnLaunched(LaunchActivatedEventArgs launchArgs) { // Create an Identity Request: // The SDK will automatically make an Identify() request during initialization, // if you know identities of the current-user, you should provide them. // Otherwise, the SDK will use the Identities of the most recent user. var identifyRequest = IdentityApiRequest.EmptyUser() .CustomerId("foo") .Email("bar") .Build(); // Create an MParticleOptions object: // You must at least provide an mParticle workspace key and secret MParticleOptions options = MParticleOptions.Builder(apiKey: "REPLACE ME", apiSecret: "REPLACE ME") .IdentifyRequest(identifyRequest) .LaunchArgs(launchArgs) .Logger(new ExampleConsoleLogger()) .Build(); // Initialize the mParticle SDK: // You must do this prior to calling MParticle.Instance var task = MParticle.StartAsync(options); HandleIdentityTaskAsync(task); Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); Window.Current.Content = rootFrame; } if (launchArgs.PrelaunchActivated == false) { if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage), launchArgs.Arguments); } Window.Current.Activate(); } }