Note that there are some explanatory texts on larger screens.

plurals
  1. POGet neighboring cell in Android returns null
    text
    copied!<p>I'm trying to get the neighbouring cell info in Android but the function <code>getNeighboringCellInfo()</code> always return null.</p> <p>I used the following code :</p> <pre><code>protected void getCellInfo() { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); List&lt;NeighboringCellInfo&gt; neighborCells = telephonyManager.getNeighboringCellInfo(); if (neighborCells == null) { OutUtils.debug("no neighbor cells"); } else { ... } } </code></pre> <p>The <code>context</code> variable is from a Service class.</p> <p>My AndroidManifest.xml permission</p> <pre><code>&lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt; &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/&gt; &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt; &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt; &lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt; &lt;uses-permission android:name="android.permission.SEND_SMS" /&gt; &lt;uses-permission android:name="android.permission.WAKE_LOCK"/&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; </code></pre> <p>I tried with and without enabling the "Use 2G networks" option in Android.</p> <p>Any idea ? Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload