특정 확장자의 파일을 Activity와 연동시키기
Here is how I defined my activity in my AndroidManifest.xml to get this to work.
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file" />
<data android:mimeType="" />
<data android:pathPattern="..kdb" />
<data android:host="*" />
The scheme of “file” indicates that this should happen when a local file is opened (rather than protocol like http).
mimeType can be set to “*” to match any mime type.
pathPattern is where you specify what extension you want to match (in this example .kdb). The “.*” at the beginning matches any squence of characters. These strings require double escaping, so “.” matches a literal period. Then, you end with your file extension.
Finally, according to the Android documentation, both host and scheme attributes are required for thepathPattern attribute to work, so just set that to the wildcard to match anything.
Now, if you select a .kdb flie in an app like Linda File Manager, my app shows up as an option. I should note that this alone does not allow you to download this filetype in a browser, since this only registers with the file scheme. Having an app like Linda File Manager on your phone resisters itself generically allowing you to download any file type.