Hello again Richard,

I have a quick question.

The SignalStrength class and setSignalStrength methods in the two
lines below are not part of the Android SDK or other Android telephony
related classes. Did you write it, or did you find it somewhere else?

            SignalStrength.setSignalStrength(signalPercent);
            SignalStrength.setSignalStrengthASU(signalStrength);

Thanks.

Alex Donnini

On Apr 9, 10:18 pm, alexdonnini <alexdonn...@ieee.org> wrote:
> Hello Richard,
>
> Thanks very much. This is very helpful. I am using the same SDK
> version but in this case I was not using the SDK.
>
> I had been experimenting with LocationListener too. I had been using
> onLocationChanged.
>
> Again, Thanks.
>
> Alex Donnini
>
> On Apr 9, 7:32 pm, Richard Schilling <richard.rootwirel...@gmail.com>
> wrote:
>
> > I have the SDK version 1.1r1 on my machine, and Actually don't see
> > this API call in the current version.  What version of the SDK are you
> > using?
>
> > Anyway, I assume you want to cell tower location and such.  Try
> > creating a listener, and then registering your listener with the
> > TelephonyManager.
>
> > Start by giving your application the following permissions:
>
> >      android.permission.ACCESS_FINE_LOCATION
> >      android.permission.ACCES_COARSE_LOCATION
>
> > Then, create your listener:
>
> > // implement both phone state listener and location listener.
> > public class PhoneSignalListener extends PhoneStateListener
> >         implements LocationListener{
>
> >         /**
> >          * @param signalStrength signal strength in ACU.
> >          */
> >         public void onSignalStrengthChanged(int signalStrength){
>
> >                 float signalPercent = ((float)signalStrength)/31f * 100f;
> >                 SignalStrength.setSignalStrength(signalPercent);
> >                 SignalStrength.setSignalStrengthASU(signalStrength);
>
> >         }
>
> >         public void onCellLocationChanged(CellLocation cellLoc){}
>
> >         public void onLocationChanged(Location loc) {}
>
> >         public void onProviderDisabled(String arg0) {}
>
> >         public void onProviderEnabled(String arg0) {}
>
> >         public void onStatusChanged(String arg0, int arg1, Bundle arg2) {}
>
> > }
>
> > And then you register it with TelephonyManager.  In your application's
> > main activity (Activity.onCreate()):
>
> > public class MyActivity extends Activity{
>
> >     public void onCreate(Bundle savedInstanceState) {
> >         TelephonyManager telManager = (TelephonyManager)
> > this.getSystemService(Context.TELEPHONY_SERVICE);
> >         telManager.listen(new PhoneSignalListener(),
> >                         PhoneStateListener.LISTEN_SERVICE_STATE |
> >                         PhoneStateListener.LISTEN_SIGNAL_STRENGTH |
> >                         PhoneStateListener.LISTEN_CELL_LOCATION);
> >     }
>
> > }
>
> > As the phone location changes you get the information delivered,
> > wrapped in a pretty package with a bow, to the Phone signal listener.
>
> > Richard Schilling
> > Root Wireless
>
> > On Apr 9, 11:15 am,alexdonnini<alexdonn...@ieee.org> wrote:
>
> > > Hello,
>
> > > Although the manifest file in my application contains
>
> > > <uses-permission
> > > android:name="android.permission.CONTROL_LOCATION_UPDATES" />
>
> > > the operation,
>
> > > mTelephonyManager.enableLocationUpdates();
>
> > > fails with
>
> > > 04-09 14:01:01.754: WARN/System.err(5495):
> > > java.lang.SecurityException: Neither user 10026 nor current process
> > > has android.permission.CONTROL_LOCATION_UPDATES.
>
> > > Could anyone help me understand where I am making a mistake, and how
> > > to correct it?
>
> > > Thanks.
>
> > > Alex Donnini
--~--~---------~--~----~------------~-------~--~----~
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