Creating Service with Bluetooth activation in Android
- by Mr. Kakakuwa Bird
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.