How to shut down phone from within an Application?

by TonyDoc » Sat, 27 Feb 2010 06:20:57 GMT

Sponsored Links
 Is there anyway I can shut down the phone from my app without the need
for user confirmation?


Other Threads

1. Lat, Longs are not changing even for new locations

Hi Friends,

This is kiran new to android. I am trying to find latitude and
longitude through NetworkProvider.

I got values for lat and langs when i am executing the applicarion
first time and the values are not changing even i am moving  200
meters far from current location.(I am executing newly in the new
location ie after 200 mt  ) .

My code is as fallowing

public class WhereAmI extends Activity {
    /** Called when the activity is first created. */
        public void onCreate(Bundle savedInstanceState) {
                LocationManager locationManager;
                String context = Context.LOCATION_SERVICE;
                locationManager = (LocationManager)getSystemService(context);
                String provider = LocationManager.NETWORK_PROVIDER;
                Location location =

                private void updateWithNewLocation(Location location) {

                        String latLongString;
                        TextView myLocationText;

                        myLocationText = 
                        if (location != null) {

                        double lat = location.getLatitude();
                        double lng = location.getLongitude();
                        double alt=location.getAltitude();
                        latLongString = "Lat:" + lat + "\nLong:" + 
                        } else {
                        latLongString = "No location found";
                myLocationText.setText("Your Current Position is:\n"



what can i do for getting updated lat ,longs for new locations?

Can any one help me?

Thanks and Regards,



2. capturing Home key event at application level


How can we capture home key event?
I am storing some data at application level, I want to clear it so
that it doesn't consume memory when my application is in background.
At the same time, i wish that this data shouldn't get earsed if my
application has gone in the background because of an incoming call.

Do I need to capture key event in every activity? Is it possible to
handle it at application level, so that i dont have to handle it in
every activity and rewrite the same code.


3. Android WebView style background-color:transparent ignored on android 2.2

4. Multitouch buttons

5. Supend to disk

6. Dynamically adding view in layout xml in android

7. Custom Kernel developement for Android Emulator