Example of a Programmatically Controlled Session
Example of a Programmatically Controlled Session
In the example below, the current session ends and a new one begins when an item is bought.
using AppDynamics.Agent;
...
public async Task BuySaleItemAsync(SaleItem item)
{
try
{
bool buySucceeded = await this.MobileService.InvokeApiAsync<SaleItem, bool>("buy", item);
if (buySucceeded)
{
await UserDialogs.Instance.AlertAsync("Thanks for buying this item");
Instrumentation.StartNextSession();
}
}
catch (Exception e)
{
Debug.WriteLine(@"Unexpected error {0}", e.Message);
}
}