Problem with NeighboringCellInfo, CID and LAC
<p>For a while I was trying to get CellID and LAC of near base stations. Unfortunately I did not manage to do that. First option was to use:</p>

<pre><code>GsmCellLocation xXx = new GsmCellLocation();  
    CID = xXx.getCid();  
    LAC = xXx.getLac();  
    Toast output = Toast.makeText(getApplicationContext(), "Base station LAC is "+LAC+"\n" 
      +"Base station CID is " +CID, Toast.LENGTH_SHORT);  
    output.show();
</code></pre>

<p>But in this case I receive -1 value (as I understand that means it is not a GSM, but when i check with isGSM it shows "true").
Another way I have found surfing the net (i updated it a bit)</p>

<pre><code>public void GetID(){  
 List&lt;NeighboringCellInfo&gt;  neighCell = null; 
 TelephonyManager telManager = ( TelephonyManager )getSystemService(Context.TELEPHONY_SERVICE); 
 neighCell = telManager.getNeighboringCellInfo();  
 for (int i = 0; i &lt; neighCell.size(); i++) {  
 try {  
   NeighboringCellInfo thisCell = neighCell.get(i);  
   int thisNeighCID = thisCell.getCid();  
   int thisNeighRSSI = thisCell.getRssi();  
   log(" "+thisNeighCID+" - "+thisNeighRSSI);  
 } catch (NumberFormatException e) {  
   e.printStackTrace();
   NeighboringCellInfo thisCell = neighCell.get(i);  
   log(neighCell.toString());  
 }  
}  
}
</code></pre>

<p>But in this case the application just crashes right after I press the execute button. Eclipse shows no errors. May be someone have any ideas how to fix my problems?</p>

<p>Logcat says:
10-05 22:53:27.923: ERROR/dalvikvm(231): Unable to open stack trace file '/data/anr/traces.txt': Permission denied</p>

<p>Used permissions:</p>

<pre><code>&lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
&lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
&lt;uses-permission android:name="android.permission.SEND_SMS"&gt;&lt;/uses-permission&gt;
&lt;uses-permission android:name="android.permission.RECEIVE_SMS"&gt;&lt;/uses-permission&gt;
&lt;uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES" /&gt;
</code></pre>

<p>May be the problem is that i forgot to include:</p>

<p>TelephonyManager telManager = ( TelephonyManager )getSystemService(Context.TELEPHONY_SERVICE); ?</p>

<p>Update. I included row from above, crash is gone but now after I press the button nothing happens.
Updated source code.</p>
