Android: Exception with sending ParcelFileDescriptor via Intent

前端 未结 1 1992
-上瘾入骨i
-上瘾入骨i 2020-12-21 17:28

I am writing an android app where my service needs to send an image to some other apps (via a broadcast message or by starting a service - there a multiple apps that might b

相关标签:
1条回答
  • 2020-12-21 18:22

    Yes, it is not possible to pass a ParcelFileDescriptor through an Intent. Although this does not seem to be clearly documented in the Android docs.

    Alternatives:

    • use Bundle.putBinder() to pass a Binder which will return a Parcel with the PFD (from API 18).
    • use a "bound service", started with Context.bindService(), where you again get a Binder through which to obtain the PFD.
    0 讨论(0)
提交回复
热议问题