开发者

Register application to handle all file type - Android

开发者 https://www.devze.com 2023-04-06 19:48 出处:网络
I am writing an android app for transferring files using Bluetooth. I am trying to register my application using following in the manifest but it seems it is only registered with images files only. M

I am writing an android app for transferring files using Bluetooth.

I am trying to register my application using following in the manifest but it seems it is only registered with images files only. My app does not show-up when I chose other file types from file manager.

 <activity android:name="SendFile"
                      android:label="@string/app_name"
                      android:theme="@android:style/Theme.NoTitleBar" >

                    <intent-filter>
                       <action android:name="android.intent.action.MAIN" />
                       <category android:name="android.intent.category.LAUNCHER" />
                      </intent-filter>

                       <开发者_运维百科;intent-filter>
                        <action android:name="android.intent.action.VIEW" />
                        <data android:mimeType="application/*"/>
                        <category android:name="android.intent.category.BROWSABLE" />                  
                        <data android:scheme="content" android:host="*" android:pathPattern="*" />
                        <data android:scheme="file" android:host="*" android:pathPattern="*" />

                       </intent-filter> 


                   </activity>

Where I am doing wrong?


I am writing an android app for transferring files using Bluetooth.

No, you are not. Nothing in that manifest fragment has anything to do with this. Instead, you are claiming that you can view all images, audio files, videos, and things with application/ as the leading portion of the MIME type. It is highly unlikely that your application is capable of doing these things.

My app does not show-up when I chose other file types from file manager.

Since there is no file manager in Android, that perhaps is a question for whoever wrote whatever file manager you are using. I would expect your audio and video files to behave as the images. The last <intent-filter> is unlikely to be honored by Android. And, of course, you should be deleting all of these <intent-filter> elements, unless you are actually capable of viewing all of those file types.

0

精彩评论

暂无评论...
验证码 换一张
取 消