I'm working on an android app which could view or edit pdf files.
My app shows up in the "Open file using..." screens.
here is the screenshot
But when I click a pdf file from google files file manager app, it shows "Open with" screen and my app is not there. here is the screenshot
This is my intent filter in manifest.xml :
<intent-filter android:label="View or edit your pdf files">
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT"/>
<data android:scheme="content" />
<data android:mimeType="application/pdf" />
</intent-filter>
How can I make my app visible in the "Open with" screen like Drive Pdf Viewer and WPS Office in the second screenshot ?
I have applied your code in my app and everything worked fine. Don't know what exactly is happening here, but in your case you can define intent filters with lots of actions and data type (category is not necessary in my opinion) to see that if your app can be a candidate to handle the intent. Then in the activity receiving the intent, in the onNewIntent() method, you check all the properties of the incoming intent to see what's is missing in your current solution. All the possible intent's actions can be found in the document (you dont need to define all of them, just add the most popular ones and see the result)
https://developer.android.com/reference/android/content/Intent
Related
I am trying to make a video player app. I can play video by opening my app manually. But I want to show my app as an option like below picture:
in short, when I click any video file in file manager, this will show my app as an option for playing that video. When user click on my app this will open a particular activity and start playing that file. How can I do this?
add intent filter to activity.
very similar to this.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="video/*" />
</intent-filter>
also see this Forcing an app chooser
Read how to achieve this in official documentation
You need to put an intent filter in your manifest.xml. This tells the OS which types of media/ files your app is capable of handling. When you click a video file in file manager, Android issues an implicit intent . This basically puts out a wanted ad (excuse the analogy) to other apps that the file needs to be handled. When this happens, if your app has the capability to handle this file/ media type, it will respond. From here, if there is only one capable app, it will be selected for the task. If there are multiple capable apps, all of them will be added to a list, which is then displayed to the user (the list in the image you posted above.)
Add the below code to inside activity(that you want to open) inside manifest:
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="video/*"/>
<data android:scheme="content"/>
<data android:scheme="file"/>
</intent-filter>
use below code to your activity to get the uri of your file. I have tested the path in exoplayer.
Uri uri = getIntent().getData();
I need to add my application to share list when I click to "Share" button on some image in gallery (for instance) and then I want to get this image in ImageView.
Share List
Thanks for help!
Intent filters inform the Android system what intents your application is willing to accept.
For images, you’d add the following to your AndroidManifest.xml
<activity android:name=".ui.MyActivity" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
When the gallery application tries to share an image by constructing an intent and passing it to startActivity(), your application will be listed as an option in the Android Sharesheet or intent resolver. Upon selecting your app, the corresponding activity (.ui.MyActivity in the example above) will be started. It is then up to you to handle the content appropriately within your code and UI.
More info here
you can check following link here it was mentioned exactly what you want to achieve
I am trying to implement a new feature for my android application.
scenario :
when some event occurs, the camera sends an email to my (Gmail) account.
on opening the mail, it will have a link (html).
when user clicks on that link, it should launch my application Home activity.
I need to understand :
how to create that html link.
how can i make the link to launch my application Home activity.
kindly help me to understand what all things i need to do in my application.
I used "Blackbelt's" user comment and i was able to get the intent html link working.
But my problem is : i want to use a custom scheme "mobile" instead of "http"
I am using Gmail to use the link. But when i send using custom scheme. Gmail doesnt recogonise as hyperlink. So i cannot click on the link.
Please help me how to use a custom scheme. with gmail
you need to register an intent-filter for your Activity on the AndroidManifest.xml file, defining a custom url. . E.g.
<activity android:name="path.to.YourActivity" >
<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:scheme="https"
android:host="it.is.my.app" />
</intent-filter>
</activity>
So if you press on a link like https://it.is.my.app, you should be prompted with the android intent chooser, with your app
I would like to register my app as Android app system for the selection of files (like Dropbox).
Basically when the user is, for example, on a web page in the browser and press the html button "Browse ..." the operating system should show the available options (system gallery, GDrive, Dropbox, etc.) and also my app. Once you select the file (in this case CSV) should be returned to the field in the file browser and and processed as a normal file.
how can I register the app as file picker and how can I return the file to the app caller?
Thanks
You need in your Manifest.xml define intent filter for your Activity like this:
<intent-filter android:label="#string/pick_file">
<action android:name="android.intent.action.GET_CONTENT" />
<data android:mimeType="*/*"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.OPENABLE" />
</intent-filter>
Where's "mime-type" is your file extension, that you want to choose. You can read more about it here.
I want users to see my app in the list when they are selecting an image from another app.
Lets take the Facebook app for example. You can select an image to attach to a post, which brings up the "Complete action using" dialog that normally just contains "Gallery". I want my app to appear in this list.
(Most similar questions are regarding picking an image from my own app, which is not at all what I wish to accomplish)
Add a intent filter to the activity that you wish to start. The correct intent for Facebook is PICK:
<intent-filter>
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
However, this does not cover the same scenario for the Tumblr app, which apparently uses some other intent for the same type of action (attaching a photo).