0

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

3
  • 1
    Use LogCat to examine the Java stack trace associated with your crash: stackoverflow.com/questions/23353173/… Commented Feb 20, 2016 at 15:27
  • it is fatal error and from logcat it point to startService(intent); so what is wrong start services form library using explicit intent ? Commented Feb 20, 2016 at 15:56
  • Please edit your question and post the full stack trace. Commented Feb 20, 2016 at 15:57

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.