Using the following code, I'm trying to get the available cell information:
import android.telephony.CellInfo;
TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService( context.TELEPHONY_SERVICE );
List<CellInfo> cellList = telephonyManager.getAllCellInfo();
Knowing that the method getAllCellInfo() and class CellInfo was introduced in API Level 17, I've set android:minSdkVersion="17" in the AndroidManifest.xml file.
However, in Eclipse I'm getting an errors stating: The import android.telephony.CellInfo cannot be resolved and The method getAllCellInfo() is undefined for the type TelephonyManager
I've tried cleaning, closing Eclipse and rebuilding my project, but I'm still getting these errors. I'm at a loss as to why Eclipse is not recognizing these declarations
Thanks for your help.
Edit: Permission android.permission.ACCESS_COARSE_LOCATION is also included within the AndroidManifest.xml file. But the issue still remains.
Check your project.properties
file and look at the target you are building against. It should look something like this:
target=Google Inc.:Google APIs:17
This is an old project I had on hand which was building for API 17 (with Google APIs.)
You can also go into the Project properties and check the target in the UI. That setting corresponds to this file and is what Eclipse uses to build against, not the manifest. The manifest is used at runtime on the platform to know what compatibility modes to enable in the framework.