Created
June 4, 2017 05:56
-
-
Save ericbrunner/f8060bb381a7724feab7347d691e8e36 to your computer and use it in GitHub Desktop.
GpsTrackerServiceBroadcastReceiver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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