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. Android 1.5: Service

Hi,

This may be very basic question but I really cannot find any proper solution
for this.

I was developing app (which have service) on Android 2.2. Then I realize
that I should also make it compatible to Android 1.5.

But for android 1.5, onStartCommand() method was not there and instead
onStart() method was there. And for Android 2.0+, onStart() method is
deprecated.

So my question is, As Java don't have support for pre-processor directives,
do I need to make two build (one for android 1.5+ and other for android
2.0+)?

Or is there any easy solution for this problem?

Thanks in advance.

Mahavir

-- 

2. How to Get List of all Devices Connected to the Same Wi-Fi Network

I'm relatively new to Network/Socket programming so I haven't dabbled too 
much into it.

As my phone is connected to a particular Wi-Fi network, I want to get a list 
of all other devices (phone, computer, or other misc) that are connected to 
the same network. One of the ways that I tried to accomplish this was this:

   Enumeration<InetAddress>   address;
   Enumeration<NetworkInterface>   nets;

   nets = NetworkInterface.getNetworkInterfaces();
   for (NetworkInterface netint : Collections.list(nets))
   {
      address = netint.getInetAddresses();
      for (InetAddress inetAddress : Collections.list(address))
      {
         Log.d(LOG_TAG, "Host name: " + inetAddress.getHostName() +
            "   IP: " + inetAddress);
      }
   }

However, all I get is the phone's IP address and a loopback call with 
LocalHost. I get the same result with this code:

   InetAddress host = InetAddress.getLocalHost();
   InetAddress[] address = InetAddress.getAllByName(host.getHostName());

   for (InetAddress result : address)
      {
         Log.d(LOG_TAG, "IP Address:: " + result.getHostName());
      }


When trying to search for this, I've only come across how to detect multiple 
networks but not devices. Does anyone know of a way I can retrieve this 
list?

-- 

3. ASUS EEE Pad bakalan RILIS pertama di INDONESIA!

4. [WTA] Widget untuk set on/off data enabled (mobile networks).

5. Questions about integrating FLV/VP6 codec into Stagefright

6. Kernel porting with GIT recommandation?

7. Apa yah ini?