Android open video with custom app - android

one of my project I was develop video player app for android.
when we browse video using android device file explorer and select it then usually
popup a window and show the possible video player apps.
as showing red area in this image
In my case I wanna show my video player app just like this red area apps showing. how can I do this. Is there any way to do this in programmatically in android.

you have to mention intent filter for your activity that plays video,so that it is visible for other apps.
you can read more about that here
Allowing Other Apps to Start Your Activity
example:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="video/*" />
<data android:mimeType="application/sdp" />
</intent-filter>
you can also see the answer given by #Michell Bak

Related

Is it possible to only show your app as a receiver in the share sheet for a certain number of attachments for Android?

Hi I want my app to show in the share sheet only if the user has selected 5 or less files but I am not sure if that is possible. So far I have the following code in the manifest so that my app will show when the user selects multiple attachments. I don't want my app to deal with it when the user selects my app, I just want my app to not show up in the first place on that condition.
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>

how to open app from file manager and play video directly?

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();

share via (Gallery )activity not getting closed after sharing the image

I have added my app option in share via option that comes when we share any image in gallery through share via option. I am able to see my app in share via option. But the problem is once the image is shared and after that the gallery is opened then the gallery still shows the app activity which means gallery activity is not finished even after sharing the image. How to overcome this problem ?
Here is the line of code I've added in activity tag in Manifest file :
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>

How to make my Android App to act as Image Picker [duplicate]

This question already has answers here:
What intent-filters must my app cover to appear in chooser when requestion an image from an external app?
(4 answers)
Closed 8 years ago.
I am developing an Android App which contains image collection with different type of Images.
I want my app to act as Image Picker.
For example when a user want to pick an Image to post on facebook or wahtsapp,chooser dialog gets opened with gallery app option and user select the image to post from gallery. What I want is my app should be listed in Image Picker along with Gallery so that user can select image from my app.
Thanks
Its quite simple. You can register the IntentFilter for that corresponding mime type inside your Activity tag AndoridManifest.xml and your app will also be listed among the apps which can be used to pick images. Code:
<intent-filter>
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>

how to start my own application from the native android contactdetails page?

I am taking the reference of one application from android market and i want a similar interface actually so the actual problem goes like this see-->
Step 1.) We have our native contact list in android Phone right please see the screen shot attched---->
![enter image description here][1]
step2.)Now i select a Particular Contact from this contact List Lets say I select xyz so we will
reach to the following Page see---->
![enter image description here][2]
On click of a contact Page.
On this Page the Call mobile option is the default one of the android Phone but after that there is a second row
coming with the option of Walkie-talkie thats the customised one by the application developer now when you click on that walkie talkie then it starts your application screenshot attached as----->
on click of the walkie talkie
![enter image description here][3]
now it lands to the application.
Now the thing is where should i make changes to add that option of walkie talkie to start your own application.
like here they gave Walkie talkie on the contact details page the similar option i want to give for my application also
then where should i give this option??
1)We cannot make the changes in the OS files as it is the application.
2)There Must be some option in the android-manifest.xml file to give this option of putting a new row to start
our own application from the android Native Contact Details Page.I tried googling it but could not figure out much.
3) See there are intents to interact with the native Phone call or SMS so like that only for example to send the sms on click on call phone we can do like this to move it to our application like if you click on call Mobile then we are able to give options like see ----->
<activity
android:name=".KVSMSLiteActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="Send Voice SMS">
<action android:name="android.intent.action.CALL_PRIVILEGED"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
<intent-filter android:label="Send Voice SMS">
<action android:name="android.intent.action.SENDTO"/>
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
</intent-filter>
</activity>
enter code here like this....
on click on the call mobile
if you click on dial it goes to android native phone call and if you click on Send Voice SMS then it goes to my application for this what they did is see in the android-manifest.xml file for mail activity they putted this option---->
So can you Please suggest me how i can put a new row after the android native call Mobile row.....??
![enter image description here][4]
finally how to do this
Thanks for giving your time.....:-)
Regards,
Narendra.

Categories

Resources