0

My project is a download manager that open a link to download something. I want to add this feature that when I use chrome Bower and click in a link , my application suggest to user to use it for opening the link.

I used

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

but there is no effect.

here is my manifest:

   <application
    android:allowBackup="true"
    android:icon="@drawable/gigaget"
    android:label="@string/app_name">


    <activity
        android:name=".ui.main.MainActivity"
        android:label="@string/app_name"
        android:theme="@style/Theme.App.Blue"
        android:launchMode="singleTask">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>

            <action android:name="us.shandian.giga.intent.DOWNLOAD"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <data
                android:mimeType="application/*"
                android:host="*"
                android:scheme="http"/>
            <data
                android:mimeType="application/*"
                android:host="*"
                android:scheme="https"/>
        </intent-filter>
    </activity>

    <activity
        android:name=".ui.main.DetailActivity"
        android:label="@string/app_name"
        android:theme="@style/Theme.App.Blue">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

    </activity>

    <activity
        android:name=".ui.web.BrowserActivity"
        android:label="@string/browser"
        android:theme="@style/Theme.App.Blue">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

    </activity>

    <activity-alias
        android:name=".ui.web.BrowserActivity-share"
        android:label="@string/open_with_gigaget"
        android:targetActivity=".ui.web.BrowserActivity">

        <intent-filter>
            <action android:name="android.intent.action.SEND"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:mimeType="text/*"/>
        </intent-filter>

    </activity-alias>

    <activity
        android:name=".ui.settings.SettingsActivity"
        android:label="@string/settings"
        android:theme="@style/Theme.App.Blue">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

    </activity>

    <activity
        android:name="com.nononsenseapps.filepicker.FilePickerActivity"
        android:label="@string/app_name"
        android:theme="@style/Theme.App.Blue">

    </activity>

    <service
        android:name=".service.DownloadManagerService"/>

</application>

with this permissions:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

why I cant see my application as suggested app for download like the other applications. any help?

nsr
  • 115
  • 13

1 Answers1

0

You need to tell android that your app should become part of the chooser

In the manifest you have to declare that you have an activity that can handle the relevant content

<manifest ... >
    <application ... >
        <activity android:name=".MyDownloadActivity" ...>
            <intent-filter >
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.SENDTO" />

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

                <data
                    android:mimeType="*/*"
                    android:scheme="file" />
            </intent-filter>
            <intent-filter > <!-- mime only SEND(_TO) -->
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.SENDTO" />
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.CATEGORY_OPENABLE" />
                <data android:mimeType="*/*" />
            </intent-filter>
        </activity>
    </application>
Punit Sharma
  • 2,951
  • 1
  • 20
  • 35