Android intent filter: associate app with file extension

You need multiple intent filters to address different situation you want to handle. Example 1, handle http requests without mimetypes: <intent-filter> <action android:name=”android.intent.action.VIEW” /> <category android:name=”android.intent.category.BROWSABLE” /> <category android:name=”android.intent.category.DEFAULT” /> <data android:scheme=”http” /> <data android:host=”*” /> <data android:pathPattern=”.*\\.pdf” /> </intent-filter> Handle with mimetypes, where the suffix is irrelevant: <intent-filter> <action android:name=”android.intent.action.VIEW” /> <category android:name=”android.intent.category.BROWSABLE” /> … Read more

How to implement my very own URI scheme on Android

This is very possible; you define the URI scheme in your AndroidManifest.xml, using the <data> element. You setup an intent filter with the <data> element filled out, and you’ll be able to create your own scheme. (More on intent filters and intent resolution here.) Here’s a short example: <activity android:name=”.MyUriActivity”> <intent-filter> <action android:name=”android.intent.action.VIEW” /> <category … Read more

Android Respond To URL in Intent

I did it! Using <intent-filter>. Put the following into your manifest file: <intent-filter> <action android:name=”android.intent.action.VIEW” /> <category android:name=”android.intent.category.DEFAULT” /> <category android:name=”android.intent.category.BROWSABLE” /> <data android:host=”www.youtube.com” android:scheme=”http” /> </intent-filter> This works perfectly!

Launch custom android application from android browser

Use an <intent-filter> with a <data> element. For example, to handle all links to twitter.com, you’d put this inside your <activity> in your AndroidManifest.xml: <intent-filter> <data android:scheme=”http” android:host=”twitter.com”/> <action android:name=”android.intent.action.VIEW” /> </intent-filter> Then, when the user clicks on a link to twitter in the browser, they will be asked what application to use in order … Read more

Intent Action for Download Completion not visible in AndroidManifest.xml

You can do like this. DownloadManager downloadManager; downloadManager = (DownloadManager)getSystemService(Context.DOWNLOAD_SERVICE); Uri uri = Uri.parse(“http://xxx.apk”); DownloadManager.Request request = new DownloadManager.Request(uri); // You can choose network type request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI); downloadManager.getRecommendedMaxBytesOverMobile(getApplicationContext()); final long flag = downloadManager.enqueue(request); IntentFilter filter = new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE ); BroadcastReceiver receiver = new BroadcastReceiver(){ @Override public void onReceive(Context context, Intent intent) { long anotherFlag = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID,-1); … Read more