Retrieve every Neighbor CID on Android Platform

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

Retrieve every Neighbor CID on Android Platform

Postby cyborneo » Sat Aug 08, 2009 1:43 am

Hi Androiders,

nice to meet you,
i am saleem from indonesia.
is it possible to retrieve every neighbor CID (six neighbor CID) with their signal strength on android platform ?
where i could find the complete source code which discuss it ?

please help me and thanks in advance for all your help...

Regards,

Saleem (cyborneo@yahoo.com)

====FOR SALE====
www.fanaticgame.com
www.4jj1.com
==============
cyborneo
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Aug 07, 2009 2:28 pm

Top

Re: Retrieve every Neighbor CID on Android Platform

Postby Ripityom » Mon Nov 02, 2009 1:28 pm

Hi!

I think you're looking for this:

TelephonyManager test = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
List<NeighboringCellInfo> neighboringCells = test
.getNeighboringCellInfo();

Late reply, but I hope it helped :)

Regards,
Ripityom

cyborneo wrote:Hi Androiders,

nice to meet you,
i am saleem from indonesia.
is it possible to retrieve every neighbor CID (six neighbor CID) with their signal strength on android platform ?
where i could find the complete source code which discuss it ?

please help me and thanks in advance for all your help...

Regards,

Saleem (cyborneo@yahoo.com)

====FOR SALE====
www.fanaticgame.com
www.4jj1.com
==============
Ripityom
Freshman
Freshman
 
Posts: 5
Joined: Wed Oct 07, 2009 2:06 pm

Postby saurabhtaneja15 » Tue Nov 24, 2009 12:01 am

Hi all

I have also written a code for accessing GSM neighboringCellInfo. It runs but does not return anything. Can anyone help please?

package com.android.GSMTester;

import java.util.List;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.telephony.NeighboringCellInfo;
import android.telephony.TelephonyManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class GSMTester extends Activity {
TextView mainText;
TelephonyManager mainGSM;
GSMReceiver receiverGSM;
List<NeighboringCellInfo> gsmList;
StringBuilder sb = new StringBuilder();

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mainText = (TextView) findViewById(R.id.mainText);
mainGSM = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

receiverGSM = new GSMReceiver();
registerReceiver(receiverGSM, new IntentFilter());
mainGSM.getNeighboringCellInfo();
mainText.setText("\nStarting Scan...\n");
}

public boolean onCreateOptionsMenu(Menu menu) {
menu.add(0, 0, 0, "Refresh");
return super.onCreateOptionsMenu(menu);
}

public boolean onMenuItemSelected(int featureId, MenuItem item) {
mainGSM.getNeighboringCellInfo();
mainText.setText("Starting Scan");
return super.onMenuItemSelected(featureId, item);
}

protected void onPause() {
unregisterReceiver(receiverGSM);
super.onPause();
}

protected void onResume() {
registerReceiver(receiverGSM, new IntentFilter());
super.onResume();
}

class GSMReceiver extends BroadcastReceiver {
public void onReceive(Context c, Intent intent) {
sb = new StringBuilder();
gsmList = mainGSM.getNeighboringCellInfo();
for(int i = 0; i < gsmList.size(); i++){
sb.append(new Integer(i+1).toString() + ".");
sb.append((gsmList.get(i)).toString());
sb.append("\n");
}
mainText.setText(sb);
}
}

}

Thanks
Saurabh
saurabhtaneja15
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Nov 20, 2009 11:41 pm

Postby icobasco » Fri Jan 15, 2010 9:21 pm

Hi saurabhtaneja15,

can you post your manifest too?

I'm putting neighbours' info on PhoneInfo (free app in the market) on the next version, so soon I'll be able to give you a more complete feedback.
User avatar
icobasco
Senior Developer
Senior Developer
 
Posts: 108
Joined: Thu Jun 04, 2009 11:12 am
Location: Italy

Retrieve every Neighbor CID on Android Platform

Postby vinays » Tue Feb 23, 2010 8:26 am

Hi icobasco,

I have a similar problem. I am on a 2G (GSM) network with I7500 from Samsung.
Firmware is 1.5. So, using API Level3.

I am getting 0 items in the list returned by getNeighbouringCells() ;

My code is a below:

Code: Select all
import android.telephony.CellLocation;
import android.telephony.NeighboringCellInfo;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;

public class Location extends Activity implements LocationListener {

private TelephonyManager tMgr ;
private TextView output ;

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        output = (TextView) findViewById(R.id.output) ;

// Get Telephone Manager and other info..
        tMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE) ;
        PhoneStateListener phoneStateListener = new PhoneStateListener() {
            @Override
            public void onCellLocationChanged(CellLocation location) {
               // TODO Auto-generated method stub
               super.onCellLocationChanged(location);
               
            }
           
            @Override
            public void onCallStateChanged(final int state, final String incomingNumber) {
               super.onCallStateChanged(state, incomingNumber) ;
               
            }
           
            @Override
            public void onSignalStrengthChanged(int asu) {
               
            }

         };
         
         
         tMgr.listen(phoneStateListener, PhoneStateListener.LISTEN_CELL_LOCATION |
                                  PhoneStateListener.LISTEN_SIGNAL_STRENGTH |
                                  PhoneStateListener.LISTEN_CALL_STATE ) ;
         List <NeighboringCellInfo> neigCellInfo = tMgr.getNeighboringCellInfo() ;
         dumpNeighbouringCellInfo ( neigCellInfo ) ;
}

private void dumpNeighbouringCellInfo(List<NeighboringCellInfo> neigCellInfo) {
      // TODO Auto-generated method stub
       StringBuilder sb = new StringBuilder() ;
       sb.append("\nNeighbouring Cell Info : ") ;
       int i = 1 ;
       for (NeighboringCellInfo cellLoc : neigCellInfo) {
          sb.append("\nCell Info ["+i+"] : ")
             .append ("\nCell Id :" )
             .append(cellLoc.getCid())
             .append("\nRSSI :")
             .append(cellLoc.getRssi())
             .append("]") ;          
       }
       log (sb.toString()) ;
      
   }

private void log(String string) {
        output[0].append(string + "\n");
     }
}


Manifest file is below:

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.location"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
        <activity android:name=".Location"
                  android:label="@string/app_name" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
    <uses-sdk android:minSdkVersion="3" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
</manifest>


Can you hint me where I am going wrong..? :?:

Thanks in advance,
Regards,
Vinay
vinays
Freshman
Freshman
 
Posts: 3
Joined: Tue Feb 23, 2010 8:09 am
Location: Bengaluru

empty list for getNeighboringCellInfo()

Postby Ripityom » Wed Feb 24, 2010 11:38 am

Hi all!

I've written a code, that lists all available cells. It worked fine on devPhone1, but since I want to run it on Samsung Galaxy Spica (Lite) the getNeighboringCellInfo() method returns an emplty list. The two device is on different carrier, but i've put my SIM to the devPhone, and it worked fine that way (so its not a carrier problem).

Also I use APNdroid (a free app in Market that tilts 3G/EDGE/GPRS, but can be switched on / off), turned the 3G/EDGE/GPRS on, still nothing.

Anyone?

Thanks:
Ripityom
Ripityom
Freshman
Freshman
 
Posts: 5
Joined: Wed Oct 07, 2009 2:06 pm

Top

Re: Retrieve every Neighbor CID on Android Platform

Postby agusfusa » Tue Aug 24, 2010 6:13 pm

Ripitiyom,

Did you manage to get the neighboring cell information from your Galaxy Spica? I'm writting an applicaction that needs this information, and I was planning to buy a Galaxy Spica to try it on a real device.

Do you happen to know if there is any access restriction to this information, particular to the Galaxy Spica?
agusfusa
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Aug 24, 2010 6:07 pm

Re: Retrieve every Neighbor CID on Android Platform

Postby reto.koenig » Sat Nov 27, 2010 9:17 pm

Hello,
I am a professor in computer science and I am currently holding Android lessons.
My students and I, we are working on several Android-Phones and we verified the same code including getNeighboringCellInfo() on HTC-Magic (2.2), Nexus-One (2.2.2), Motorola-Milestone(2.1), Samsung Galaxy S (2.1 / 2.2).

And guess what: Samsung Galaxy S NEVER returns any neighboring cells. Neither on Android 2.1 nor on Android 2.2.
This circumstance is very nasty, as even Google-Maps expects this information and hence always shows a wrong result when positioning relies on the cell-ids.

So if you need the knowledge of the neighboring cells (which indeed augments the positioning) do not use a Samsung.

Sorry for the bad news.
reto.koenig
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Nov 27, 2010 9:07 pm

Re: Retrieve every Neighbor CID on Android Platform

Postby truwer » Thu May 19, 2011 10:19 am

Hello,

i have the same problem. I don't get NeighboringCellInfos on Galaxy S and Nexus S. On HTC Hero i get sometimes the Informations, but i don't know why only sometimes?

Any ideas why?
truwer
Once Poster
Once Poster
 
Posts: 1
Joined: Mon May 02, 2011 10:47 am

Re: Retrieve every Neighbor CID on Android Platform

Postby Ripityom » Thu May 19, 2011 12:10 pm

Hi,

About the Nexus S I have no clue, but it seems that you cannot get the neighboring cells on Samsung devices. Also I have tried on ZTE Blade with no luck.
Ripityom
Freshman
Freshman
 
Posts: 5
Joined: Wed Oct 07, 2009 2:06 pm

Re: Retrieve every Neighbor CID on Android Platform

Postby whytopersist » Mon Sep 05, 2011 10:59 am

Hello,my first time to come here.

Coach outlet | Coach Handbags | Coach Bags
whytopersist
Freshman
Freshman
 
Posts: 6
Joined: Mon Sep 05, 2011 10:37 am

Top

Return to General

Who is online

Users browsing this forum: No registered users and 2 guests