[android-developers] Re: Android 1.5 SDK, Release 2 -- TelephonyManager
Hi Liam, You need to have Android libraries in your project's Libraries build path (this means that you need to have the Android project source accessible from your IDE (e.g. Eclipse), and then make sure that the Android libraries precede the Android SDK library in the build order. I hope this helps. Alex On Jun 17, 4:29 am, Ne0 wrote: > As you can probably tell, i am new to android development and rusty on > java. I have just had a quick look at cellfinder and its importing > com.android.internal packages, how do you do this? As the SDK > android.jar doesn't allow access to internal packages. > > This lack of understanding is no doubt due to one of the "black holes" > in my memories of java, shouldn't have had so many beers over the last > 5 years!! ;-) > > Liam > > On Jun 17, 9:13 am, Ne0 wrote: > > > Thanks Alex, i will look into it. > > > On Jun 16, 5:55 pm, alexdonnini wrote: > > > > Liam, > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Android 1.5 SDK, Release 2 -- TelephonyManager
As you can probably tell, i am new to android development and rusty on java. I have just had a quick look at cellfinder and its importing com.android.internal packages, how do you do this? As the SDK android.jar doesn't allow access to internal packages. This lack of understanding is no doubt due to one of the "black holes" in my memories of java, shouldn't have had so many beers over the last 5 years!! ;-) Liam On Jun 17, 9:13 am, Ne0 wrote: > Thanks Alex, i will look into it. > > On Jun 16, 5:55 pm, alexdonnini wrote: > > > Liam, > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Android 1.5 SDK, Release 2 -- TelephonyManager
Thanks Alex, i will look into it. On Jun 16, 5:55 pm, alexdonnini wrote: > Liam, > > Casting from List to ArrayList works fine. It does not cause an error. > > I guess I run into a problem because my target is Android 1.1, not 1.5 > > You can get cell and location related information in a number of > ways:using other applications as starting point. For example: > > - radioinfo.java > [platform/packages/apps/Settings.git] / src / com / android / > settings / RadioInfo.java > > - cellfinderhttp://code.google.com/p/codetastrophe/ > > - > AndroidGpsLocationProvider.javahttp://code.google.com/p/gears/source/browse/trunk/gears/geolocation/... > > With regard to duplicating the fieldtest application functionality, > you need working getNeighboringCellInfo() and other neighboring cell > related function. > > Note that if you do a dexdump of fieldtest, you will see that it uses > OEM RIL related functions to extract neighboring cell related > information (however, I could be wrong about this). > > I hope this helps. Unfortunately, I am still stuck with regards to > getNeighboringCellInfo(). > > Alex Donnini > > On Jun 16, 10:47 am, Ne0 wrote: > > > Yes it does, though you have make sure that you are building your app > > for 1.5 versions only, this is done when setting up your project using > > Eclipse, thats how i do it anyway. > > > I have yet to test my code on an actual phone, though there is one > > thing you may be clear up for me, its been many years since i have > > used java, you are using ArrayList<>, though the documentation > > describes getNeighboringCellInfo() as returning a List<>, are these > > the same thing? If not it may be an error in your code, mine works on > > the emulator using List<> though it returns NULL. > > > Hope this helps. > > > On a different note, i am trying to get other info for my app, do you > > know how to get anything other LAC, CID, Neighbour list with power? > > Like the Field test App? Cheers > > > Liam > > > On Jun 16, 3:35 pm, alexdonnini wrote: > > > > 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/TelephonyMan...() > > > > 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 mNeighboringCellInfo; > > > mNeighboringCellInfo = new ArrayList(); > > > mNeighboringCellInfo = (ArrayList) > > > mTelephonyManager.getNeighboringCellInfo(); > > > for(int i = 0; i < mNeighboringCellInfo.size(); ++i) > > > { > > > Log.i(TAG,"mNeighboringCellInfo.get(i) - > > > "+mNeighboringCellInfo.get(i).toString()); > > > } > > > > } > > > > } > > > > > > > > > android:name="android.permission.ACCESS_COARSE_LOCATION" /> > > > > > android:name="android.permission.ACCESS_FINE_LOCATION" /> > > > > > 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 -~--~--
[android-developers] Re: Android 1.5 SDK, Release 2 -- TelephonyManager
Liam, Casting from List to ArrayList works fine. It does not cause an error. I guess I run into a problem because my target is Android 1.1, not 1.5 You can get cell and location related information in a number of ways:using other applications as starting point. For example: - radioinfo.java [platform/packages/apps/Settings.git] / src / com / android / settings / RadioInfo.java - cellfinder http://code.google.com/p/codetastrophe/ - AndroidGpsLocationProvider.java http://code.google.com/p/gears/source/browse/trunk/gears/geolocation/AndroidGpsLocationProvider.java With regard to duplicating the fieldtest application functionality, you need working getNeighboringCellInfo() and other neighboring cell related function. Note that if you do a dexdump of fieldtest, you will see that it uses OEM RIL related functions to extract neighboring cell related information (however, I could be wrong about this). I hope this helps. Unfortunately, I am still stuck with regards to getNeighboringCellInfo(). Alex Donnini On Jun 16, 10:47 am, Ne0 wrote: > Yes it does, though you have make sure that you are building your app > for 1.5 versions only, this is done when setting up your project using > Eclipse, thats how i do it anyway. > > I have yet to test my code on an actual phone, though there is one > thing you may be clear up for me, its been many years since i have > used java, you are using ArrayList<>, though the documentation > describes getNeighboringCellInfo() as returning a List<>, are these > the same thing? If not it may be an error in your code, mine works on > the emulator using List<> though it returns NULL. > > Hope this helps. > > On a different note, i am trying to get other info for my app, do you > know how to get anything other LAC, CID, Neighbour list with power? > Like the Field test App? Cheers > > Liam > > On Jun 16, 3:35 pm, alexdonnini wrote: > > > 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/TelephonyMan...() > > > 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 mNeighboringCellInfo; > > mNeighboringCellInfo = new ArrayList(); > > mNeighboringCellInfo = (ArrayList) > > mTelephonyManager.getNeighboringCellInfo(); > > for(int i = 0; i < mNeighboringCellInfo.size(); ++i) > > { > > Log.i(TAG,"mNeighboringCellInfo.get(i) - > > "+mNeighboringCellInfo.get(i).toString()); > > } > > > } > > > } > > > > > > android:name="android.permission.ACCESS_COARSE_LOCATION" /> > > > android:name="android.permission.ACCESS_FINE_LOCATION" /> > > > 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 -~--~~~~--~~--~--~---
[android-developers] Re: Android 1.5 SDK, Release 2 -- TelephonyManager
Oh and I used this code, rather than the once off code to get it to show an update once a second... public class TelephonyTest extends Activity { private static String TAG = "TelephonyTest"; private static TelephonyManager mTelephonyManager; private Thread t = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mTelephonyManager = (TelephonyManager)getSystemService(TelephonyTest.TELEPHONY_SERVICE); t = new Thread(new Runnable() { public void run() { try { while(true) { doLog(); Thread.sleep(1000); } } catch (Exception e) {} } }); t.start(); } private void doLog() { ArrayList mNeighboringCellInfo; mNeighboringCellInfo = new ArrayList(); mNeighboringCellInfo = (ArrayList)mTelephonyManager.getNeighboringCellInfo(); if(mNeighboringCellInfo.size() == 0) Log.i(TAG, "No Neighboring Cells detected."); for(int i = 0; i < mNeighboringCellInfo.size(); ++i) { Log.i(TAG,"mNeighboringCellInfo.get(i) - "+ mNeighboringCellInfo.get(i).toString()); } } } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Android 1.5 SDK, Release 2 -- TelephonyManager
2009/6/17 Ne0 > I have yet to test my code on an actual phone, though there is one > thing you may be clear up for me, its been many years since i have > used java, you are using ArrayList<>, though the documentation > describes getNeighboringCellInfo() as returning a List<>, are these > the same thing? If not it may be an error in your code, mine works on > the emulator using List<> though it returns NULL. I've run it on a device but no network to test against until the weekend, but I just upgraded to SDK 1.5rc2 and it seems to work fine. > > android:name="android.permission.ACCESS_COARSE_LOCATION" /> > According to documentation, and my testing, you only need this permission to access the function you're after. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[android-developers] Re: Android 1.5 SDK, Release 2 -- TelephonyManager
Yes it does, though you have make sure that you are building your app for 1.5 versions only, this is done when setting up your project using Eclipse, thats how i do it anyway. I have yet to test my code on an actual phone, though there is one thing you may be clear up for me, its been many years since i have used java, you are using ArrayList<>, though the documentation describes getNeighboringCellInfo() as returning a List<>, are these the same thing? If not it may be an error in your code, mine works on the emulator using List<> though it returns NULL. Hope this helps. On a different note, i am trying to get other info for my app, do you know how to get anything other LAC, CID, Neighbour list with power? Like the Field test App? Cheers Liam On Jun 16, 3:35 pm, alexdonnini wrote: > 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/TelephonyMan...() > > 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 mNeighboringCellInfo; > mNeighboringCellInfo = new ArrayList(); > mNeighboringCellInfo = (ArrayList) > mTelephonyManager.getNeighboringCellInfo(); > for(int i = 0; i < mNeighboringCellInfo.size(); ++i) > { > Log.i(TAG,"mNeighboringCellInfo.get(i) - > "+mNeighboringCellInfo.get(i).toString()); > } > > } > > } > > > android:name="android.permission.ACCESS_COARSE_LOCATION" /> > android:name="android.permission.ACCESS_FINE_LOCATION" /> > 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 -~--~~~~--~~--~--~---