Android Intent Filter zip

I want to use an intent filter that makes the app open when clicking on a zip file in fileexplorer

so what mimetype do I need to use? and which codee to get the path?

    android:label="@string/app_name" >
      <action android:name="android.intent.action.SEND" />

      <category android:name="android.intent.category.DEFAULT" />

      <data android:mimeType="text/plain" />




Java code:

Intent intent = getIntent();

        // To get the action of the intent use
        String action = intent.getAction();
        if (action != Intent.ACTION_SEND) {
            throw new RuntimeException("Should not happen");
        // To get the data use
        Uri data = intent.getData();
        URL url;
        try {
            url = new URL(data.getPath());
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block



source to share

1 answer

You can use the following IntentFilter


    <action android:name="android.intent.action.VIEW"/>

    <category android:name="android.intent.category.DEFAULT"/>

    <data android:mimeType="application/zip"/>


When your activity is started it has data URI

from which you can get a zip file:

File zip = new File(getIntent().getData().getPath());




All Articles