title: GSM signal strength measurements in android application always show 0
body: <p>signal strength always show 0</p>
  
  <p>This code is running without error but always showing signal strength is 0. I tried to run this code both on my emulator and my android device but it is showing signal strength 0.</p>
  
  <p>please give detail description for getting correct signal strength of my mobile network and also of the code for getting of signal strength of other network in area if possible.</p>
  
  <p>MainActivity.java</p>
  
  <pre><code> package com.example.termproject;
   import android.os.Bundle;
   import android.view.Menu;
   import android.view.View;
   import android.app.Activity;
   import android.telephony.PhoneStateListener;
   import android.telephony.SignalStrength;
   import android.telephony.TelephonyManager;
   import android.content.Context;
   import android.widget.Toast;
  
   public class MainActivity extends Activity 
   {
      TelephonyManager Tel;
      MyPhoneStateListener MyListener;
      private int signal;
  
       @Override
       public void onCreate(Bundle savedInstanceState)
       {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_main);
  
       }
  
       @Override
                 public boolean onCreateOptionsMenu(Menu menu) 
       {
           getMenuInflater().inflate(R.menu.activity_main, menu);
           return true;
       }
       class MyPhoneStateListener extends PhoneStateListener
       {
         int signal;
         @Override
         public void onSignalStrengthsChanged(SignalStrength signalStrength)
         {
            super.onSignalStrengthsChanged(signalStrength);
            signal = signalStrength.getGsmSignalStrength();
         }
       }
       public void myaction(View v)
       {
          MyListener = new MyPhoneStateListener();
           Tel = ( TelephonyManager )getSystemService(Context.TELEPHONY_SERVICE);
           Tel.listen(MyListener ,PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
           Toast.makeText(getApplicationContext(), "GSM signal strength is " +    String.valueOf(this.signal), Toast.LENGTH_SHORT).show();
       }
   }
  </code></pre>
  
  <p>Manifest.xml</p>
  
  <pre><code> &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="com.example.termproject"
       android:versionCode="1"
       android:versionName="1.0" &gt;
  
       &lt;uses-sdk
           android:minSdkVersion="8"
           android:targetSdkVersion="15" /&gt;
       &lt;!-- PERMISSIONS --&gt;
      &lt;uses-permission android:name="android.permission.CALL_PHONE"&gt;&lt;/uses-permission&gt;
      &lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  
  
      &lt;!-- LICENSE PERMISSIONS --&gt;    
      &lt;uses-permission android:name="com.android.vending.CHECK_LICENSE" /&gt;
  
      &lt;!-- USES --&gt;
      &lt;uses-feature android:name="android.hardware.telephony"      android:required="false"/&gt;
       &lt;application
           android:icon="@drawable/ic_launcher"
           android:label="@string/app_name"
           android:theme="@style/AppTheme" &gt;
           &lt;activity
               android:name=".MainActivity"
               android:label="@string/title_activity_main" &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;/application&gt;
  
   &lt;/manifest&gt;
  </code></pre>
  
  <p>activity_main.xml</p>
  
  <pre><code> &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:tools="http://schemas.android.com/tools"
       android:layout_width="match_parent"
       android:layout_height="match_parent" &gt;
  
       &lt;TextView
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:layout_centerHorizontal="true"
           android:layout_centerVertical="true"
           tools:context=".MainActivity" /&gt;
       &lt;Button
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="@string/button_send" 
           android:onClick="myaction"/&gt;
  
  
   &lt;/RelativeLayout&gt;
  </code></pre>