Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. open android system camera occurs error using jni invoke java
Forum Updated to NodeBB v4.3 + New Features

open android system camera occurs error using jni invoke java

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 347 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    senmx
    wrote on last edited by
    #1

    java:

    public void callExternalCamera() {
        String action = "android.media.action.IMAGE_CAPTURE";
        Intent intent = new Intent(action);
        File extDir = android.os.Environment.getExternalStorageDirectory();
        String filename = "camera.jpg";
        File photo = new File(extDir, filename);
        Uri takePhotoSavedUri = Uri.fromFile( photo );
        intent.putExtra(MediaStore.EXTRA_OUTPUT, takePhotoSavedUri);
        int SHOOT_PHOTO = 1;
        startActivityForResult(intent, SHOOT_PHOTO);//This line caused, if delete this then it's ok.
    }
    

    qt:

    QAndroidJniObject activity = QtAndroid::androidActivity();
    activity.callMethod<void>("callExternalCamera","()V");
    

    error:

    F .s.p: java_vm_ext.cc:570] JNI DETECTED ERROR IN APPLICATION: JNI GetStaticMethodID called with pending exception android.os.FileUriExposedException: file:///storage/emulated/0/camera.jpg exposed beyond app through ClipData.Item.getUri()
    F .s.p: java_vm_ext.cc:570]   at void android.os.StrictMode.onFileUriExposed(android.net.Uri, java.lang.String) (StrictMode.java:2083)
    F .s.p: java_vm_ext.cc:570]   at void android.net.Uri.checkFileUriExposed(java.lang.String) (Uri.java:2395)
    F .s.p: java_vm_ext.cc:570]   at void android.content.ClipData.prepareToLeaveProcess(boolean, int) (ClipData.java:977)
    ...
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      senmx
      wrote on last edited by
      #2

      https://stackoverflow.com/questions/48117511/exposed-beyond-app-through-clipdata-item-geturi

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved