Why doesn't you find an app when you open the intent?



  • That's the situation. I've got it all figured out, but it's the last one.

    I have two apps on my phone, one that sends an intent and the other. 3d model viewer Where I want this intent to send

    I'm looking for applications that can open my file.

    public void reeee(View view) {
        String path = "/storage/emulated/0/Android/data/com.example.android.camera2basic/files/default/AvatarModelDir/20160614_233755.dae";
        File file = new File(path);
    
    //checking if the File exists
    if(file.exists()) {
    
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(file), "text/xml");
    
        boolean result = isIntentAvailable(getApplicationContext(), intent);
    
        if (result){
            startActivity(intent);
        }
    }
    

    }

    public static boolean isIntentAvailable(Context context, Intent intent) {
    List<ResolveInfo> list = context.getPackageManager().queryIntentActivities(intent,
    PackageManager.MATCH_DEFAULT_ONLY);

    for (int i = 0; i &lt; list.size(); i++){
        Log.e("!!!!!!!!!!!!!!!!!!!!!!", "!!!!!!!!!!!!!!!!!!!!! " + list.get(i));
    }
    
    return !list.isEmpty();
    

    }

    List list- the apps that can open my file, only 1 annex.

    That's what the log prints.

    ResolveInfo{e7de143 com.android.htmlviewer/.HTMLViewerActivity m=0x608000}

    Found a standard viver and everything. Why doesn't I need an app. 3d model viewer?

    I thought the problem was... 3d model viewer Manifeste not written intent-filterBut on another device, I have a manager's file. I downloaded my file on this device. 3d model viewerAnd I open it through the conductor, and I have the apple I need. ♪ ♪

    So you can open it with a side application!

    What about mine? intent Is that right?

    Checked through the app. Dexplorer Manifest's file and there's an intent filter.

    введите сюда описание изображения

    But how do we call him?

    Final version of the

    public void reeee(View view) {

    String path = "/storage/emulated/0/Android/data/com.example.android.camera2basic.demo/files/default/AvatarModelDir/Anna.dae";
    File file = new File(path);
    
    //checking if the File exists
    if(file.exists()) {
        Intent intent = new Intent();
    
        intent.setAction(Intent.ACTION_VIEW);
    

    intent.setDataAndType(Uri.fromFile(file), "application/octet-stream");

        boolean result = isIntentAvailable(getApplicationContext(), intent);
    
        if (result){
            startActivity(intent);
        }
    }
    



  • Suspect to plant a type of content "text/xml" I don't know. And to find out exactly what the filters are in the back of the annex. https://play.google.com/store/apps/details?id=com.dexplorer and look at AndroidManifest.xml of the right application.

    I've seen this HD Model Viewer manifest, he's taking either intens without MIME type or MIME. "*/*"or "application/octet-stream"♪ Well, the scheme supports only https, https, file and content. For your journey /storage/emulated/0/Android/data/com.example.android.camera2basic/files/default/AvatarModelDir/20160614_233755.dae The system, theoretically, has to finish the file, but it's better to ask it yourself: file:///storage/emulated/0/Android/data/com.example.android.camera2basic/files/default/AvatarModelDir/20160614_233755.dae♪ In addition, this path is clearly inside your application and will therefore only have access to it from your application. So if you want to give it access to other applications through the Intent, read it. https://developer.android.com/training/secure-file-sharing/setup-sharing.html ♪




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2