{"id":541,"date":"2017-10-09T21:19:46","date_gmt":"2017-10-09T21:19:46","guid":{"rendered":"http:\/\/www.netexl.com\/blog\/?p=541"},"modified":"2026-04-02T10:15:16","modified_gmt":"2026-04-02T10:15:16","slug":"cordova-plugins-review-unnecessary-permissions","status":"publish","type":"post","link":"https:\/\/www.netexl.com\/blog\/cordova-plugins-review-unnecessary-permissions\/","title":{"rendered":"Cordova Plugins: Review Unnecessary Permissions"},"content":{"rendered":"<p>If you went through the article on <a href=\"https:\/\/www.netexl.com\/blog\/add-social-sharing-feature-to-html5-game-using-intel-xdk\/\" target=\"_blank\">adding social sharing feature in HTML5 game using Intel XDK<\/a>, it seemed like a simple plugin which should not require any permission but after adding the plugin and few more other plugins I found that WRITE_EXTERNAL_STORAGE permission was added in my android app so I checked all plugins one by one to see which plugin is adding what permissions and found out that WRITE_EXTERNAL_STORAGE\u00a0permission was being added by social sharing plugin.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-542 size-full\" src=\"https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2017\/10\/Cordova_Plugin_Permission.png\" alt=\"Cordova Plugin Permissions\" width=\"1366\" height=\"696\" srcset=\"https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2017\/10\/Cordova_Plugin_Permission.png 1366w, https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2017\/10\/Cordova_Plugin_Permission-300x153.png 300w, https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2017\/10\/Cordova_Plugin_Permission-768x391.png 768w, https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2017\/10\/Cordova_Plugin_Permission-1024x522.png 1024w, https:\/\/www.netexl.com\/blog\/wp-content\/uploads\/2017\/10\/Cordova_Plugin_Permission-280x143.png 280w\" sizes=\"auto, (max-width: 1366px) 100vw, 1366px\" \/><\/p>\n<p>When I checked developer notes (quoted below) I found that the permission was not required in my case, since I was not fetching any remote images for sharing.<\/p>\n<blockquote><p>For sharing remote images (or other files) on Android, the file needs to be stored locally first, so add this permission to <code>AndroidManifest.xml<\/code>:<\/p>\n<p>&lt;<span class=\"pl-ent\">uses-permission<\/span> <span class=\"pl-e\">android<\/span><span class=\"pl-e\">:<\/span><span class=\"pl-e\">name<\/span>=<span class=\"pl-s\"><span class=\"pl-pds\">&#8220;<\/span>android.permission.WRITE_EXTERNAL_STORAGE<span class=\"pl-pds\">&#8220;<\/span><\/span> \/&gt;<\/p><\/blockquote>\n<p>In fact it was just a simple play store URL which I was sharing in my app so it was an unnecessary permission in my app which was going to scare a few\u00a0customers who were very sensitive about permissions they had to give while installing an app so I decided to remove the permission. Intel XDK had no option is modify permissions so it went down to manual edit.<\/p>\n<div class=\"highlight highlight-text-xml\">\n<p>Once\u00a0you have exported the build package from Intel XDK, and added the platform using cordova cli tools (check <a href=\"https:\/\/www.netexl.com\/blog\/compile-phaser-games-or-any-other-html5-game-as-android-store-app-using-intel-xdk-part-1\/\" target=\"_blank\">blog post<\/a> for more details), look at following 3 places and remove.<\/p>\n<p>Go to plugins folder, find the plugin and edit plugin.xml and remove following section<\/p>\n<pre class=\"lang:default decode:true\">    &lt;config-file target=\"AndroidManifest.xml\" parent=\"\/*\"&gt;\r\n      &lt;uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"\/&gt;\r\n    &lt;\/config-file&gt;<\/pre>\n<p>Go to\u00a0platforms\u00a0&#8211;&gt; android folder, find AndroidManifest.xml,\u00a0edit this file and remove following line<\/p>\n<pre class=\"lang:default decode:true\">&lt;uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" \/&gt;<\/pre>\n<p>Go to\u00a0platforms\u00a0&#8211;&gt; android folder, find android.json, edit this file and remove the permission. Be careful and make sure\u00a0edited file remains\u00a0a valid json.<\/p>\n<pre class=\"lang:default mark:4-7 decode:true\">            \"AndroidManifest.xml\": {\r\n                \"parents\": {\r\n                    \"\/*\": [\r\n                        {\r\n                            \"xml\": \"&lt;uses-permission android:name=\\\"android.permission.WRITE_EXTERNAL_STORAGE\\\" \/&gt;\",\r\n                            \"count\": 1\r\n                        },\r\n                        {\r\n                            \"xml\": \"&lt;uses-permission android:name=\\\"android.permission.INTERNET\\\" \/&gt;\",\r\n                            \"count\": 1\r\n                        },\r\n                        {\r\n                            \"xml\": \"&lt;uses-permission android:name=\\\"android.permission.ACCESS_NETWORK_STATE\\\" \/&gt;\",\r\n                            \"count\": 1\r\n                        }\r\n                    ],\r\n<\/pre>\n<p>Now\u00a0build\u00a0APK and check for permissions and related functionalities. Everything works just fine so\u00a0we\u00a0got the learning\u00a0to always go through developer notes to find out why certain permissions\u00a0are required and if we are not going to use\u00a0respective features, then we may just get away with removing those permissions. We do need to properly test to make sure nothing breaks after removing the permissions but unnecessary permissions are always going to scare a few customers off so it is worth risk taking.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you went through the article on adding social sharing feature in HTML5 game using Intel XDK, it seemed like a simple plugin which should not require any permission but after adding the plugin and few more other plugins I found that WRITE_EXTERNAL_STORAGE permission was added in my android app so I checked all plugins one by one to see which plugin is adding what permissions and found out that WRITE_EXTERNAL_STORAGE\u00a0permission was being added by social sharing plugin. When I checked developer notes (quoted below) I found that the permission was not required in my case, since I was not fetching any remote images for sharing. For sharing remote images (or other files) on Android, the file needs to be stored locally first, so add this permission to AndroidManifest.xml: &lt;uses-permission android:name=&#8220;android.permission.WRITE_EXTERNAL_STORAGE&#8220; \/&gt; In fact it was just a simple play store URL which I was sharing in my app so[&#8230;]<\/p>\n","protected":false},"author":5,"featured_media":1540,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,13,6],"tags":[],"class_list":["post-541","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","category-how-to","category-intel-xdk","category-plugin"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts\/541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/comments?post=541"}],"version-history":[{"count":4,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts\/541\/revisions"}],"predecessor-version":[{"id":672,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/posts\/541\/revisions\/672"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/media\/1540"}],"wp:attachment":[{"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/media?parent=541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/categories?post=541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.netexl.com\/blog\/wp-json\/wp\/v2\/tags?post=541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}