I want to start service from aosp libray.And I have used this code.
Intent intent = new Intent(ExternalStorageFormatter.FORMAT_AND_FACTORY_RESET);
intent.setComponent(ExternalStorageFormatter.COMPONENT_NAME);
// Transfer the storage volume to the new intent
final StorageVolume storageVolume = getIntent().getParcelableExtra(
StorageVolume.EXTRA_STORAGE_VOLUME);
intent.putExtra(StorageVolume.EXTRA_STORAGE_VOLUME, storageVolume);
startService(intent);
finish();
and when I run the app.It crashes and not working for me. How to fix this