Android: deviceId null (TelephonyManager)
<p>i have a problem with TelephonyManager. DeviceId is null/blank.
This's my code. Where I wrong?</p>

<p>RegistryActivity.java</p>

<blockquote>
  <p>package android.tennis.app;</p>
  
  <p>import android.tennis.library.UserFunctions; <br>
  //import android.tennis.library.InfoPhoneAndroid; <br>
  import android.content.Context; <br>
  import android.telephony.TelephonyManager; <br>
  import android.provider.Settings.Secure; <br></p>
  
  <p>[...]  <br></p>
  
  <p>public class RegisterActivity extends Activity { <br></p>
  
  <p>private String deviceID = null, androidID = null; <br></p>
  
  <p>@Override <br>
     public void onCreate(Bundle savedInstanceState) {<br> 
         super.onCreate(savedInstanceState); <br></p>

<pre><code>   setContentView(R.layout.register);
</code></pre>
  
  <p>[..]<br></p>

<pre><code>  final TelephonyManager telephonyManager = 
</code></pre>
  
  <p>(TelephonyManager) getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
         deviceID = telephonyManager.getDeviceId(); <br></p>
  
  <p>[..] <br></p>

<pre><code>   btnRegister.setOnClickListener(new View.OnClickListener() {
       public void onClick(View view) {
</code></pre>
  
  <p>[..]</p>

<pre><code>           UserFunctions userFunction = new UserFunctions();
           JSONObject json = userFunction.registerUser(nome, email, password, username, citta, data_di_nascita, cognome, deviceID);
</code></pre>
  
  <p>} // class RegisterActivity <br></p>
</blockquote>

<p>When registerUser calls index.php, deviceId is null. Why?</p>

<p>Thank you in advanced!</p>

<p>D</p>

<p>My manifest file is:</p>

<pre><code>&lt;uses-sdk android:minSdkVersion="8" /&gt;

&lt;application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" &gt;
    &lt;activity
        android:label="@string/app_name"
        android:name=".DashboardActivity" &gt;
        &lt;intent-filter &gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;

            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;

    &lt;!--  Login Activity --&gt;
    &lt;activity
        android:label="Login"
        android:name=".LoginActivity"&gt;

    &lt;/activity&gt;

    &lt;!--  Register Activity --&gt;
    &lt;activity
        android:label="Register New Account"
        android:name=".RegisterActivity"&gt;&lt;/activity&gt;
&lt;/application&gt;

&lt;!-- Allow to connect with internet --&gt;
&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
&lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
</code></pre>

<p>I use an emulator. If I digit *#60#, the outupt is: 00000000</p>
