title: Android Broadcast Issue - 60 Second Delay in Receiving Message
body: <p>We have a process that broadcasts a message using the following code. This message is received and processed by a BroadcastReceiver (given below). We have a curious problem on some Android tablets and phones. The message that is broadcast is not received by the receiver for exactly 60 seconds. It is as if there is something that prevents the message from being broadcasted/delivered for 60 seconds. We have triple checked the code and there is no artificial delay being introduced in the code. Has anyone else seen this issue? We will appreciate any insight on the issue.</p>
  
  <p>We are using Xamarin.Android 4.1.0 and have seen the issue on Samsung Note 10.1 and Note 3. We have not seen it on Nexus 7 or Sony tablets.</p>
  
  <pre><code>public static void BroadcastResult(string SN, string result, string errorMessage, string commandType = "DataBatch")
  {
      try
      {
           Android.Content.Intent broadcastIntent = new Android.Content.Intent("com.GoServicePro.ProcessorResults");
           broadcastIntent.PutExtra("Type", commandType);
           broadcastIntent.PutExtra("SN", SN.ToString());
           broadcastIntent.PutExtra("RESULT", result);
           broadcastIntent.PutExtra("EXCEPTION", errorMessage);
  
           if (Global.gCustomizerCol != null)
           {
               if (Global.gCustomizerCol.Count &gt; 0)
               {
  
               }
           }
  
           if (Global.CurrentContext == null)
               Android.App.Application.Context.SendBroadcast(broadcastIntent);
           else
               Global.CurrentContext.SendBroadcast(broadcastIntent);
  
           Logging.LogToProcessorLog("Broadcasted results: &lt;" + commandType + ":" + SN + ":" + result + ":" + errorMessage + "&gt;");
          }
          catch (Exception ex)
          {
              Logging.LogToProcessorLog("EXCEPTION: " + ex.Message + "\n" + ex.StackTrace);
          }
      }
  
  
      [BroadcastReceiver(Enabled = true, Label = "GoServicePro Receiver")]
      [IntentFilter(new string[] { "com.GoServicePro.ProcessorResults" })]
      public class ProcessorReceiver : BroadcastReceiver
      {
          /// &lt;summary&gt;
          /// Handler for processing completed message brodcasted by GoServiceProProcessorService.
          /// &lt;/summary&gt;
          /// &lt;param name="context"&gt;&lt;/param&gt;
          /// &lt;param name="intent"&gt;&lt;/param&gt;
          public override void OnReceive(Context context, Intent intent)
          {
              string commandType = intent.GetStringExtra("Type");
  
              try
              {
                  string sn = intent.GetStringExtra("SN");
                  string result = intent.GetStringExtra("RESULT");
                  string error = intent.GetStringExtra("EXCEPTION");
  
                  switch (commandType)
                  {
                      case "DataBatch":
                          if (result == "SUCCESS")
                          {
                              Global.gintGSASeqNumIn += 1;
                              Database.UpdateBootDataSeqInfo();
                              Communication.QueueAck(Global.gintGSASeqNumIn);
                              Logging.LogMsg("Batch# " + sn + " was processed successfully.");
  
                              if (Global.SendRefresh != null)
                                  Global.SendRefresh.Invoke(true, "ACTIVE_TAB", true, "GENERAL", 0, true);
                              Logging.LogMsg("Refresh sent to Main and WO forms", 2);
                          }
                          else if (result == "ABORT_FOR_BEGIN_REFRESH")
                              Logging.LogMsg("Batch# " + sn + " was aborted by SECONDARY process because it had BEGIN_FULL_REFRESH command. It will be processed by PRIMARY process");
                          else
                          {
                              Logging.LogMsg("Batch with serial# " + sn + " was NOT saved successfully. Error was:\n" + error);
                              Logging.LogMsg("Will retry batch with serial# " + sn);
                          }
                          break;
  </code></pre>
  
  <p>.
  .
  .
  .</p>