Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericbrunner/f8060bb381a7724feab7347d691e8e36 to your computer and use it in GitHub Desktop.
Save ericbrunner/f8060bb381a7724feab7347d691e8e36 to your computer and use it in GitHub Desktop.
GpsTrackerServiceBroadcastReceiver
using System;
using Android.App;
using Android.Content;
using trucker_rolsped.Helper.HockeyApp;
namespace trucker_rolsped.Droid.GeoLocation
{
[BroadcastReceiver(Enabled = true, Exported = true, Name = GpsConstants.GpsBroadcastReceiver, Label = "RestartServiceWhenStopped")]
[IntentFilter(new[] {GpsConstants.GpsRestart})]
public class GpsTrackerServiceBroadcastReceiver : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
try
{
MetricsManagerHelper.Instance.SendGenericMessageToApplicationInsights("Gps-Info", "OnReceive :: Gps Service broadcast message received. Restarting GPS Service...");
context.StartService(new Intent(context, typeof(GpsTrackerService)));
}
catch (Exception e)
{
MetricsManagerHelper.Instance.SendExceptionToApplicationInsights(e);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment