Android Question eligible "OPEN WITH" for own file extension (*.abc)

Tayfur

Well-Known Member
Licensed User
Longtime User
hello;

I want to add eligible option for "OPEN WTIH"

For example, I want to open a "*.html" file, after I see Chrome, Firework. etc.
Or... I want to open a "*.pdf" file, after I see Chrome, AdobeAcrobat etc.
Or... I want to open a "*.jpg" file, after I see Gallery, Airdroid etc.

Now; I have spcial file extension.(from exsample xxxx.abc) and
I want see my app in "OPEN WITH " menu when open "xxx.abc" in file maneger.
How can I do it???? how can I add Android system???
 

moster67

Expert
Licensed User
Longtime User
Never tried it myself but found this in the forum:

Code to insert in Manifest:

B4X:
AddActivityText(main,
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/x-vcard" />
</intent-filter>)
Replace mime-type with your extension.

Then in your app you need to act on the request somehow. Again a search in the forum showed this thread:

As I said, I never tried it but it may get you going in the right direction.

Hope this is what you're looking for...
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User

tgtp is own file extension

http://developer.android.com/guide/topics/manifest/data-element.html

B4X:
<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <data android:scheme="file" />
  <data android:mimeType="*/*" />
  <data android:pathPattern=".*\\.tgtp" />  
  <data android:host="*" />
</intent-filter>
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User
have you tried
too?

or maybe

B4X:
AddActivityText(main,
<intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <data android:scheme="file" />
  <data android:mimeType="*/*" />
  <data android:pathPattern="\\*\\*.tgtp" /> 
  <data android:host="*" />
</intent-filter>)

No.. no .. (

do you have a little working sample ?
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
Found this post by googling:

 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User
its works...
@moster67 and @DonManfred Many Many thanks...

Now; next step : I must found file path/name etc. I will reserch it.


B4X:
AddActivityText(main,
         <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="http" android:host="*"
                    android:pathPattern=".*\\.tgtp" />
                <data android:scheme="https" android:host="*"
                    android:pathPattern=".*\\.tgtp" />
                <data android:scheme="content" android:host="*"
                    android:pathPattern=".*\\.tgtp" />
                <data android:scheme="file" android:host="*"
                    android:pathPattern=".*\\.tgtp" />
            </intent-filter>
)
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User

Now is everything is ok. Thank you for helps.

B4X:
ub Activity_Resume
     Dim in As Intent
in = Activity.GetStartingIntent
If in <> Null Then
    
        Log(in.GetExtra("path"))
        Dim XmlData As String
   
        XmlData = in.GetData
     
       
        Msgbox(XmlData,"")
'       Send_Make_somthing(in)
'       Activity.Finish
       Return
  
End If
End Sub
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User
This is for ZIP files.
it need a special line.
<data android:mimeType="application/zip" />


B4X:
AddActivityText(main,
         <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:mimeType="application/zip" />
                <data android:scheme="http" android:host="*"
                    android:pathPattern=".*\\.zip" />
                <data android:scheme="https" android:host="*"
                    android:pathPattern=".*\\.zip" />
                <data android:scheme="content" android:host="*"
                    android:pathPattern=".*\\.zip" />
                <data android:scheme="file" android:host="*"
                    android:pathPattern=".*\\.zip" />
            </intent-filter>
)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…