Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamically associate file type with my application
    text
    copied!<p>i have an application which associates pdf files in my Manifest(via intent-filters), so when someone click on pdf link in the default browser i can execute that action with my app and download it with a progressbar. my question is, is it a way that i can associate other files but not "hard coded" in my manifest, but to let the user choose(or write) that file extention in preferences for example and i can add it dynamically from code. i know that probably this can be done with broadcast receiver but cant find any examples or simple code for that matter. ive seen preference menu like that in bsplayer settings .. but cant post image cuz dont have enough reputation.</p> <p>I will try to explain more detailed my problem, because i think that there was some misunderstanding with the answer below.</p> <ol> <li><p>i have an application which have the fallowing code in my manifest.</p> <pre><code> &lt;intent-filter&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;data android:scheme="http" /&gt; &lt;data android:host="*" /&gt; &lt;data android:pathPattern=".*\\.pdf" /&gt; &lt;/intent-filter&gt; </code></pre></li> </ol> <p>2.i launch my app which registers .pdf files with it. so next time i click on pdf link in my browser, a window pops up, making me choose with what application should i complete that action. if i choose my application, my main activity is launched, in which i use getIntent() and my app downloads the file using progressbar.</p> <p>3.the problem is that i want to download and other files like that ie. jpg, png .. etc, but giving the user a choice which ones, or even making him write the extentions for the files he wants to download using my application if clicks on link somewhere that leads to that kind of files.</p> <p>4.to make this thing happen, file extensions should be added dynamically in code somewow and not in manifest. i was looking some examples for broadcast receiver, since that class can use IntentFilter class, but cant really understand what i should be doing with it.</p> <p>5.My main goal: starting my app, there is layout with some spinner or edit box. the user choose/writes some extension (.dwf). that extension is now registered with my app. if the next time the user browsing internet clicks on link which leads to .dwf file he could choose to continue the action with my app. and the file should be downloaded just like the .pdf</p> <p>6.sry for my bad english and some help will be appreciated. also code ;)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload