title: Cannot pass an integer - as an extra in an intent - from Unity to an Android app
body: <p>I need to communicate an integer value from an Unity app to an Android one using an Intent. The Android app implements a receiver that expects this integer as an extra parameter in the Intent.</p>
  
  <p>My Unity (C#) code looks like this:</p>
  
  <pre><code>int timestamp = 0; // whatever value
  var playerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");             
  var activity = playerClass.GetStatic&lt;AndroidJavaObject&gt;("currentActivity");
  var intent = new AndroidJavaObject("android.content.Intent", ACTION_LOCK_DATE);
  intent.Call("putExtra", "timestamp", timestamp);
  activity.Call("sendBroadcast", intent);
  </code></pre>
  
  <p>But when running it, I get the error:</p>
  
  <pre><code>I/Unity   ( 4034): AndroidJavaException: java.lang.NoSuchMethodError: no method with name='putExtra' signature='(Ljava/lang/String;I)V' in class Landroid/content/Intent;
  I/Unity   ( 4034): java.lang.NoSuchMethodError: no method with name='putExtra' signature='(Ljava/lang/String;I)V' in class Landroid/content/Intent;
  I/Unity   ( 4034):  at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
  I/Unity   ( 4034):  at com.unity3d.player.UnityPlayer.a(Unknown Source)
  I/Unity   ( 4034):  at com.unity3d.player.UnityPlayer$b.run(Unknown Source)
  </code></pre>
  
  <p>As if it were not recognising the second <em>int</em> parameter. Any clues?
  I also tried passing an object array with the String and the int, but it shows the same error. Passing it as an <strong>Integer</strong> instance does not work either, complaining that there is no method putExtra with with String and Integer as parameters:</p>
  
  <pre><code>var playerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");             
  var activity = playerClass.GetStatic&lt;AndroidJavaObject&gt;("currentActivity");
  var intent = new AndroidJavaObject("android.content.Intent", ACTION_LOCK_DATE);
  var integerClass = new AndroidJavaClass("java.lang.Integer");
  var ts = integerClass.CallStatic&lt;AndroidJavaObject&gt;("valueOf", timestamp);
  intent.Call("putExtra", "timestamp", ts);
  activity.Call("sendBroadcast", intent);
  </code></pre>
  
  <p>What am I missing?
  I'm going to try just parsing and passing it as a string, but I would like to avoid that and be able to pass it as a number.</p>