I want to start the app after boot completing in Background. I don't want to show the UI.
This is my code, it starts the app as if I clicked its icon, but I need to hide it!
[BroadcastReceiver]
[IntentFilter(new[] { Android.Content.Intent.ActionBootCompleted },
Categories = new[] { Android.Content.Intent.CategoryDefault }
)]
public class ReceiveBoot: BroadcastReceiver
{
public override void OnReceive(Context context, Intent intent)
{
if ((intent.Action != null) &&
(intent.Action ==
Android.Content.Intent.ActionBootCompleted))
{
Android.Content.Intent start = new Android.Content.Intent(context, typeof(Main_Activity));
start.AddFlags(ActivityFlags.NewTask);
start.AddFlags(ActivityFlags.FromBackground);
context.ApplicationContext.StartActivity(start);
}
}
}