IBM Support

PI73910: Getting "FILEURIEXPOSEDEXCEPTION" WITH CORDOVA CAMERA PLUGIN ON ANDROID N

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Running the Cordova camera plugin on Android N causes the
    FileUriExposedException, which crashes the application. Android
    N has restricted the access of the file:// protocol URI to the
    scope of the same app. This means that the device's Camera app
    cannot pass the file URI of the image back to the original
    application, thus causing the crash.
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * Users using the Cordova camera plugin in an Android          *
    * application.                                                 *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * Starting in Android Nougat, file URIs are restricted to the  *
    * scope of the same app. This is a problem for the Cordova     *
    * camera plugin. To access photos, the camera plugin needs to  *
    * be passed file URIs. With the access restriction, the        *
    * application will crash when it tries to access a photo with  *
    * a FileUriExposed exception.                                  *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    

Problem conclusion

  • Cordova's solution to the FileUriExposed exception is to create
    a custom URI to use in place of the file URI. This resolves the
    issue, however requires adding in an Android support library in
    order to handle the custom URI. Only MobileFirst users who
    utilize the Cordova camera plugin for Android will need to do
    additional set up to get the camera plugin to work.
    
    After installing the iFix, follow these additional steps to
    setup your application so that it can use the updated Cordova
    camera plugin. If you do not intend to use the Cordova camera
    plugin, you do NOT need to perform these steps.
    
    http://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.
    worklight.dev.doc/dev/t_android_cam_api_24.html#t_android_cam_ap
    i_24
    (These instructions are the same for MobileFirst 7.0 and 6.3)
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI73910

  • Reported component name

    MOBILE1ST PLATF

  • Reported component ID

    5725I4301

  • Reported release

    630

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2016-12-16

  • Closed date

    2017-02-08

  • Last modified date

    2017-02-08

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    MOBILE1ST PLATF

  • Fixed component ID

    5725I4301

Applicable component levels

  • R630 PSY

       UP

  • R700 PSY

       UP

  • R710 PSY

       UP

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSZH4A","label":"IBM Worklight"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"630","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
08 February 2017