Make the default application to open a specific file

How to force an Android application to use the default application to open a specific file type?

I tried to clear the defaults, but the option is greyed out, does anyone know how to do this?

I want to open my application with my something.whatever files in android.

+12
source share
5 answers

You cannot force it, and you cannot do it. What you can do is that your application can open the file. The user gets the standard "which program you want to use" dialog box, and the user can select something by default. If the user has already selected the default value, he needs to cancel it before the dialog box appears (obviously, otherwise the default value would not have much effect, would it?)

You can tell the world (aka: android) that you want to open a specific type of file by adding an intent filter. Basically, you do in your manifest that the activity in your application knows how to handle the file type (or website / protocol, etc.). It's pretty easy to find, a random question here about SO for the same issue: Android intent filter for a specific file extension?

+13
source

This issue has already been addressed here: Register default application for custom file type

Add an intent filter to it:

 <intent-filter > <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="application/pdf" /> </intent-filter> 
+7
source

In Android, how to link a file to another program.

I am using "Droid Maxx" with Android version 4.4.4

How to make something.html an open file with a file editor instead of a firefly after you link Firefox to always be associated with *.html files.

You must clear the default settings for the application associated with the file type.

Do it

  1. Go to settings. "This is in the list of applications.
  2. In the "Device" section, click "Applications."
  3. Scroll down and click Firefox.
  4. Under the entry "Default Startup", click "Clear Default Settings."
  5. Open your something.html again.

Once again, you are given a choice with which program you want to open this file.

If you want to connect and separate file types with applications separately:

There is a third-party application called: Default App Manager Lite:

https://play.google.com/store/apps/details?id=com.appiator.defaultappmanager

Then you can run the program and individually manage the file type → application mappings.

+5
source

I think that in android, every application / action should have some intentional actions and categories in the manifest file. In the settings for this intention, you must make your application the default.

Even you write a default to the manifest, if any other applications found with the same intent settings, the Android system will display all applications with the same settings. the user must select one of them, only he provides one checkbox to make one default application next time. If the user has not checked, the list will be displayed each time the user opens the file.

I hope this can help you.

0
source

Try this

 Intent i = new Intent(); i.setAction(android.content.Intent.ACTION_VIEW); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setDataAndType(Uri.parse("file://"+path), "application/vnd.android.package-archive"); startActivity(i); 

The path variable is your path.

0
source

All Articles