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

Getaw Dejen
  • 341
  • 1
  • 4
  • 13
  • 1
    Use LogCat to examine the Java stack trace associated with your crash: https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this – CommonsWare Feb 20 '16 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 ? – Getaw Dejen Feb 20 '16 at 15:56
  • Please edit your question and post the full stack trace. – CommonsWare Feb 20 '16 at 15:57

0 Answers0