tabris-js icon indicating copy to clipboard operation
tabris-js copied to clipboard

Is there anyway to make tabris app open file with specific extension?

Open Nabeel20 opened this issue 5 years ago • 4 comments

I googled any cordova plugins but all of then are outdated, Is there anyway tabris.js could register a file extension and when user chose the file in the file manager app so they could open it within the tabris app?. Thanks

Nabeel20 avatar Nov 16 '20 20:11 Nabeel20

I have not used it, but there's https://github.com/farynam/cordova-fileAssociation

Other research suggests you can edit your AndroidManifest.xml as this is not Cordova-specific: https://stackoverflow.com/a/61331776

cookieguru avatar Nov 16 '20 20:11 cookieguru

@cookieguru Hi :smile: I used the following code:

 <config-file parent="application" target="AndroidManifest.xml">
         <activity android:label="Show in app" android:name="app_name">
            <intent-filter android:autoVerify="true">
               <action android:name="android.intent.action.VIEW" />
               <category android:name="android.intent.category.BROWSABLE"/>
               <category android:name="android.intent.category.DEFAULT" />
               <data android:scheme="file" />
               <data android:scheme="content" />
               <data android:scheme="http" />
               <data android:scheme="https" />
               <data android:scheme="ftp" />
               <data android:host="*" />
               <data android:pathPattern=".*\\.my_extension " />
               <data android:mimeType="*/*" />
            </intent-filter>
         </activity>
      </config-file>

How to handle the intent when user tap the file from file explorer. So I can handle the file within my app? Thank you.

Nabeel20 avatar Nov 22 '20 06:11 Nabeel20

@mpost?

cookieguru avatar Nov 22 '20 09:11 cookieguru

I would also look into plugins like the mentioned https://github.com/farynam/cordova-fileAssociation. It has a snippet on how to handle the described configuration.

mpost avatar Nov 24 '20 08:11 mpost