Creating Service with Bluetooth activation in Android
Posted
by Mr. Kakakuwa Bird
on Stack Overflow
See other posts from Stack Overflow
or by Mr. Kakakuwa Bird
Published on 2010-04-06T13:57:58Z
Indexed on
2010/04/06
14:03 UTC
Read the original article
Hit count: 368
Hi
I want to create a service in Android which will initially ask user if they want to start Bluetooth and set the Bluetooth discovery.
My question is 1) Can I launch in the service following activities?
if (!mBluetoothAdapter.isEnabled())
{
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, 0);
}
// Set Phone Discoverable for 300 seconds.
Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 600);
startActivity(discoverableIntent);
2) I want to set discoverabilty of the phone on for lifetime of application. Is it possible?
3) I want to access empty space available on SD card. How should i do it?
Thanks in advance.
© Stack Overflow or respective owner