![]() Read more about cordova intent plugin in the official repository here. We need to do something with the files (file information) that we receive and we will handle it using the following code (after onDeviceReady event): document.addEventListener('deviceready', function()", Here's when cordova-plugin-intent will help us. If you decide to build now your app, your AndroidManifest.xml should now include the properties inside the intent-filter node :Īnd if you trigger the open with (of any application) and the mimeType is correct, your app should be appear in that list now, but we still need to manipulate how will be the opened file handled with Javascript. It seems using SetData and SetType individually wont work here. I checked my code and all the mimetypes and paths are correct and are pointing to the desired file. xlsx file, it opens up perfectly in both the office apps. Note: You need to create an extra intent-filter node in your AndroidManifest.xml file, if you add these properties to an existing intent-filter, your app will compile, but you will not see the icon to start the app later. Whereas, if I go to my file manager and tap on the. Now modify the config.xml file and add the intent-filter using a config block (the custom-config plugin will add the content of the config-block directly to the AndroidManifest.xml file without remove any existing node) : Then you need to allow the use of custom configuration to the project, adding the xmlns:android=" " property to the widget node in the config.xml file, the widget should look like: $ cordova plugin add cordova-custom-config Download the required cordova plugins : # Install custom configuration Enable the use of Intent in your AppĪn Intent is a messaging object you can use to request an action from another app component. Now the problem is that we can't simply add the previous code block to our config.xml because it will be not recognized, that's where cordova-custom-config will help us to directly modify the AndroidManifest.xml from config.xml.įinally we will use cordova-plugin-intent to manipulate the intent events for our app from javascript. We need to modify the intent-filter and add the following permissions (this explicit example will make that our app can open all the kind of files, read more about android mimetypes here to filter by your required extensions) ![]() We need to know what we're going to do and why. cordova-plugin-intent : When the configuration of the previous plugin is ready, we need to manipulate the file Intents on every call (when the user executes Open With from another app and our app is not initialized etc.).cordova-custom-config : We need to change the default configuration of the AndroidManifest.xml but we will not manipulate it manually as the changes may be lost in future builds, therefore we need to use a plugin that adds the custom configuration everytime we build the app with different versions.odt extenio but my application can't use this applications to open the file.If we want that our app appears on the open with list of android, we need to allow this intent on our AndroidManifest.xml file. I don't know where is the problem, i have application for. ![]() Return filename.substring(dotIndex + 1, filename.length()) īut the problem is when i want to open any different file for example. To open image or sound we can use this code: public String getExt(String filename)įor(int i = filename.length()-1 i >= 0 i-)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |