Android getAllCellInfo() returns null
<p>I'm new to android, and I work on a project that goes to collect all cells information that observed by phone. I have used <code>TelephonyManager.getAllCellInfo()</code> method, but it always returns <code>null</code>.</p>

<p>My Code ::</p>

<pre><code>public class NetworkCoverageActivity extends AppCompatActivity {
    private String str;
    private TextView TV;
    private Button getCellsInfoBtn;
    private TelephonyManager TM;
    private List&lt;CellInfo&gt; cellInfoList;
    private PhoneStateListener PSL;
    private int event;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_network_coverage);

        TV = (TextView)findViewById(R.id.iv);
        getCellsInfoBtn = (Button)findViewById(R.id.getCellsInfoBtn);
        TM = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
        PSL = new PhoneStateListener();
        event = PSL.LISTEN_CELL_INFO | PSL.LISTEN_CELL_LOCATION;

        getCellsInfoBtn.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                TM.listen(PSL, event);
                cellInfoList = TM.getAllCellInfo();

                if(cellInfoList != null)
                    TV.append("cellInfoList = null");
                else{
                    ...
                }
        }
    });
}
</code></pre>

<p>I'm working on android 4.4.2 level 17 and set min API level to 17. and I try to collect information from GSM network.</p>

<p>Also, I added the following permission to <code>AndroidManifest.xml</code>:</p>

<pre><code>&lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt;
</code></pre>