I am using these packages
qr_code_scanner_plus: ^2.0.6
google_mobile_ads: ^5.2.0
provider: ^6.1.2
google_maps_flutter: ^2.9.0
wifi_iot: ^0.3.19+1
permission_handler: ^11.3.1
This is android\app\src\main\AndroidManifest.xml file
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="QR Scanner"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="xxxxxxxxxxx_xxxxxxxxxxxxxxx_xxxxxxxxxxx"/>
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-XXXXXXXXXXXXXXXX~XXXXXXXXXX"/>
<service
android:name=".MyTileService"
android:icon="@drawable/flutter"
android:label="QR Scanner"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:exported="true">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
</manifest>
I did not giving any permissions but my app end up using some unwanted permissions.
qr_code_scanner_plus: ^2.0.6
This package using camera.
wifi_iot: ^0.3.19+1
This is using Wi-Fi to connect to networks.
I am using google_maps_flutter: ^2.9.0
to use map as location picker. I am not using devices location. I want to get rid of these location permissions.
If someone had done this before please mention?
I figured it out.
Just do some changes in AndroidManifest.xml
STEP 1: Change first this line Add xmlns:tools="http://schemas.android.com/tools
at the end with in tag.
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
STEP 2: And add permissions with tools:node="remove"
at the end with in tag, this will restrict
packages/libraries to use/add permissions during app build.
You can ckeck my code below.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" tools:node="remove"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="remove"/>
NOTE: This only works for android.
It worked for me 100% ✅