android - Cordova register file types to 'open with' list -


i'd register ionic app (through cordova) open file types. dropbox does. when user has file on application (like email), , clicks 'open with', there's list contains dropbox app.

heres tutorial apple: https://developer.apple.com/library/ios/documentation/filemanagement/conceptual/documentinteraction_topicsforios/articles/registeringthefiletypesyourappsupports.html

is there cordova plugin support both android , ios , gives js api feature? in advance.

you can achieve filetype association in cordova.

it includes 2 steps.

1) register files in android manifest / ios plist as

manifest

<intent-filter     android:icon='@drawable/ic_launcher'         android:label='androidmht file'     android:priority='1'>     <action android:name="android.intent.action.view" />     <action android:name="android.intent.action.edit" />      <action android:name="android.intent.action.pick" />     <category android:name="android.intent.category.default" />     <category android:name="android.intent.category.browsable" />     <data android:mimetype="*/*" />     <data android:pathpattern="*.mht" /> </intent-filter> <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=".*\\.mht" />     <data android:scheme="https" android:host="*" android:pathpattern=".*\\.mht" /> </intent-filter> <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="message/rfc822" android:scheme="http" />     <data android:mimetype="multipart/related" android:scheme="http" />     <data android:mimetype="message/rfc822" android:scheme="https" />     <data android:mimetype="multipart/related" android:scheme="https" /> </intent-filter> 

plist

<key>cfbundledocumenttypes</key> <array>     <dict>         <key>cfbundletypeiconfiles</key>         <array>             <string>document-molecules-320.png</string>             <string>document-molecules-64.png</string>         </array>         <key>cfbundletypename</key>         <string>molecules structure file</string>         <key>cfbundletyperole</key>         <string>viewer</string>         <key>lshandlerrank</key>         <string>owner</string>         <key>lsitemcontenttypes</key>         <array>             <string>com.sunsetlakesoftware.molecules.pdb</string>             <string>org.gnu.gnu-zip-archive</string>         </array>     </dict> </array> 

2) use file opener plugin cordova

you may need pass necessary flags open files.

reference: android, ios , phonegap community forum thread

hope helps.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -