Hello,

I have a simple/quick question.

Does TelephonyManager in Android 1.5 SDK, Release 2 (the SDK version I
am using) contain the

getNeighboringCellInfo()

method?

The reference documentation,

http://developer.android.com/reference/android/telephony/TelephonyManager.html#getNeighboringCellInfo()

seems to indicate that it does.

However, if you try to use getNeighboringCellInfo() in an application,
it does not work generating "cannot be resolved to a type" error.

If you add the Java libraries framework intermediaries library from
Android the "cannot be resolved to a type" error is resolved but the
application crashes at run-time (VerifyError, not surprisingly).

My hope is that I am overlooking something obvious, and/or making a
simple mistake.

If my mistake is in the code below, I would appreciate seeing a
snipped that does work.

 Thanks.

Alex Donnini

P.S. here is the code of the application I wrote to test
getNeighboringCellInfo()

package com.telephonytest.com;


import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.telephony.NeighboringCellInfo;
import android.telephony.TelephonyManager;
import android.util.Log;

public class TelephonyTest extends Activity {

        private static String TAG = "TelephonyTest";
        private static TelephonyManager mTelephonyManager;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mTelephonyManager = (TelephonyManager)getSystemService
(TelephonyTest.TELEPHONY_SERVICE);

        ArrayList<NeighboringCellInfo> mNeighboringCellInfo;
        mNeighboringCellInfo = new ArrayList<NeighboringCellInfo>();
        mNeighboringCellInfo = (ArrayList)
mTelephonyManager.getNeighboringCellInfo();
        for(int i = 0; i < mNeighboringCellInfo.size(); ++i)
        {
                Log.i(TAG,"mNeighboringCellInfo.get(i) -
"+mNeighboringCellInfo.get(i).toString());
        }


    }
}


....
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_UPDATES" />

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to