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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---