Im trying to do a BootReceiver call when my own package installs/updates, but I cant seem to find how to check if the called reason is because of the package the code is in, or another app that has updated. Does such a thing exist already, and if so, how to use it?
Here is the code:
[BroadcastReceiver(Enabled = true, Exported = true, DirectBootAware = true)]
[IntentFilter(new string[] { Intent.ActionBootCompleted, Intent.ActionLockedBootCompleted, Intent.ActionPackageReplaced, "android.intent.action.QUICKBOOT_POWERON", "com.htc.intent.action.QUICKBOOT_POWERON" })]
public class BootReceiver : BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
Intent timedIntent = new Intent(context, typeof(ITM.NotificationService));
//add missed traffic before program started with boot
if(intent.Action.Equals(Intent.ActionBootCompleted) || intent.Action.Equals(Intent.ActionLockedBootCompleted))
{
timedIntent.PutExtra("aDownBootup", TrafficStats.TotalRxBytes);
timedIntent.PutExtra("aUpBootup", TrafficStats.TotalTxBytes);
}
if (ITM.NotificationService.isStarted == false)
{
Application.Context.StartService(timedIntent);
}
}
}