Executing async code from non async code

public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
{
//how do we execute async code from inside this method?
}
public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
{
base.OnStartCommand(intent, flags, startId);
Task.Run(async () => { await this.InitialiseJourney(); });

Task.Run(async () => { await this.StartJourneyTracking(); });
return StartCommandResult.NotSticky;
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dominic Burford

A father, cyclist, vegetarian, atheist, geek and multiple award winning technical author. Loves real ale, fine wine and good music. All round decent chap.