title: Android application restart after update
body: <p>I'm facing this problem.
  I've a customer that has to distribute / mantain my application on ten users. They haven't the Market installed for internal policy, so I've ended up mantaining a web service for new versions check / download. Everything works fine, the apk gets installed, but I'm not able to restart the application after the update. I've tried (I think) all the suggestions found on the net (first including the ones found here on stackoverflow); the last was inserting a broadcast receiver in the manifest, and building a static class in my code, but nothing.
  If anyone has something to suggest, I'll greatly appreciated.
  Here's my last code (I've tried also without .PACKAGE_REPLACED) :</p>
  
  <pre><code>&lt;receiver android:name="tecnici.UpdaterBroadcastReceiver" android:enabled="true"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.MY_PACKAGE_REPLACED" /&gt;
          &lt;data android:scheme="package" /&gt;
      &lt;/intent-filter&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.PACKAGE_REPLACED" /&gt;
          &lt;data android:scheme="package" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p>Inside my code :</p>
  
  <pre><code>namespace tecnici
  {
      public class UpdaterBroadcastReceiver : BroadcastReceiver
      {
          public override void OnReceive(Context context, Intent intent)
          {
              try
              {
                  PackageInfo _info = context.PackageManager.GetPackageInfo(InternalPackage.ApplicationPackage, 0);
  
                 clStaticCommon.SetSystemInfo(context,null,null,null,SyncTheme.Undefined,false);
                  clStaticCommon.WriteLog(new string[]{ "UpdateBroadcastReceiver", "Applicazione aggiornata", "Version code : " + _info.VersionCode.ToString(), "Version name : " + _info.VersionName });
                  clStaticCommon.ClearSystemInfo();
              }
              catch
              {
              }
  
              Intent _main = new Intent(context,typeof(MainActivity));
  
              _main.AddFlags(ActivityFlags.NewTask);
              context.StartActivity(_main);
          }
      }
  </code></pre>
  
  <p>The code inside try / catch serves only to write some lines in my internal log.</p>
  
  <p>Thanks.
  Rodolfo.</p>