How to simulate power off key

by Daddym85 » Tue, 28 Dec 2010 01:16:55 GMT


Sponsored Links
 Hi,
I have a Samsung Galaxy S with  Android 2.2. In order to power off the
phone, I must press and hold the  power off key. I would like to
simulate this action from a Java code. Can I do it?
Best regards,
Daddym85.

-- 



Re: How to simulate power off key

by Mark Murphy » Tue, 28 Dec 2010 01:29:08 GMT


 Only if you modify the firmware, or possibly root your phone. Normal
SDK applications cannot power off the phone.





-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 


Sponsored Links


Other Threads

1. How to make my screen :1 momentarily appear before switching to sceren:2

hi friends,
i have two layouts for scrren:1 and screen:2
all i need to make screen:1 appear momentarily before screen:2 appears
i code looks like :

public class Screen1 extends ...
 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.screen1);
public void onStart()
{  super.onstart(); startActivity(new Intent(this,Srceen2.class));  }


In Screen2 class

public class Screen2 extends ...
 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.screen2);


when i run the apk the screen2 appears .now how to make scrren1 appear
momentarily ,
 I tried to insert a code "Thread.sleep(..)  in onstart()  to make my
first screen1 appear momentarily ,but in vain
Please help
Thanks
--~--~---------~--~----~------------~-------~--~----~

2. Delay in sound playback????

Hello I've been working on a soundboard type device that plays various
mp3 files on screen taps, but the problem i'm stuck with right now is
there is a delay after the screeen is touched...

--~--~---------~--~----~------------~-------~--~----~

3. Context.startService - The service does not stay running...

4. Strange problem with this board

5. Does Android support JSR 177 APDUConnection?

6. Checking whether the screen is locked

7. what is difference between OnClickListener and OnTouchListener?