Getting internet permission in flutter app - android

I'm new to flutter and I'm in a situation to get internet permission for our flutter app which we are developing, we've used enter link description here for handling permissions. We also accessed microphone permission and it worked well. but can't get the internet permission request.
And I want to know whether internet permission(But I've mentioned in the Manifest.xml file) is not mandatory or not?

just write this in your Anroidmanifest.xml in android module in flutter project:
<uses-permission android:name="android.permission.INTERNET" />

Internet permissions are required for macOS in addition to Android so I'm adding an expanded answer.
Android
Add the following line in your AndroidManifest.xml file before the <application> section:
<uses-permission android:name="android.permission.INTERNET" />
See also the Flutter docs for creating an Android release.
macOS
Add the following key-value pair to macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements:
<key>com.apple.security.network.client</key>
<true/>
See also the Desktop support for Flutter documentation.

It can be a better solution . Paste the code below to android manifest.xml
uses-permission android:name="android.permission.INTERNET" /
uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"

Right-Click info.plist and Open As -> Source Code. This will open the file in XML format.
Add the following to the bottom of the info.plist xml file.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>

Related

Error with duplicate permissions with different maxSdkVersions (Flutter, reactiveBLE)

I am using the reactiveBLE library (which is by the way excellent, thank you for that).
However, with the newer version, it brings its own manifest file, so I don´t have to add any permissions to mine. The manifest file of reactiveBLE and one of my app are supposed to be merged together when building the app.
Because different rules are needed for different APIs, reactiveBLE adjusts its permissions accordingly. It seems that for Bluetooth, android.permission.ACCESS_FINE_LOCATION and android.permission.ACCESS_COARSE_LOCATION are only needed for APIs 23 - 30.
The code is then (for example):
uses-permission-sdk-23
android:name="android.permission.ACCESS_FINE_LOCATION"
android:maxSdkVersion="30"
However, as I also include other location services (which do need these permissions for other APIs as well), I would have to remove the "android:maxSdkVersion="30" part. This is also recommended in the official documentation:
official documentation on how to remove maxSdkVersion
However, this is not possible, because the manifest file of reactiveBle is generated automatically each time I build something (and my changes are overwritten again).
The app is working fine, but I am getting errors in the Play Console when uploading the app to the Playstore.
Please advise how I can merge the manifest files properly, so I do not get an error when uploading to the Play Console.
Kind regards
René
This solution from reactiveBLE issues worked for me.
To prevent conflicts with you own permissions, in your AndroidManifest.xml file include:
<uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="remove"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission-sdk-23 android:name="android.permission.ACCESS_COARSE_LOCATION" tools:node="remove"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
You will also need to add xmlns:tools="http://schemas.android.com/tools" in the manifest tag at the top of the file.

Shoutem - Add location permission in custom extension

I'm working on Shoutem application, I created a custom extension for display restaurants listing nearby user current location.
It's required "android.permission.ACCESS_FINE_LOCATION" location, So I follow the step as per Shoutem document. (App segment)
https://shoutem.github.io/docs/extensions/tutorials/modifying-native-project#app-segment
And copied the complete android and iOS directory from shoutem.places extension and rename the file and directory name as per my extension name.
But still I'm getting this error.
Looks like the app doesn't have the permission to access location
https://ibb.co/jDBZ5N1
1. How can I get the permissions in my custom extension ?
And
2. what will be the package name of my custom extension at AndroidManifest.xml file?
AndroidManifest.xml file in my custom extension.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.chrsitian.restaurants">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest>

Add android.permission.CAMERA with Cordova

I am using the latest version of Cordova (6.3.1) and I want the following permission to appear in the AndroidManifest.xml :
<uses-permission android:name="android.permission.CAMERA" />
Adding this line by hand does not work because the XML is regenerated each time I run the command cordova run android
I have added the cordova-plugin-camera to my project with
cordova plugin add cordova-plugin-camera
This plugin does NOT add the CAMERA permission in the AndroidManifest.xml
I don't know if this is normal
How can I add this permission to my project ?
Edit :
Usually, Cordova plugins are in charge of adding required permissions into the manifest. The camera plugin does not add this specific permission, I wonder :
if the plugin should add this permission (bug ? I have opened an issue on their Jira tracker)
if I can add this permission by hand myself, maybe in the Cordova's config.xml
I don't think the Camera plugin ever added this permission to AndroidManifest.xml. Looking through the Github repo, WRITE_EXTERNAL_STORAGE was added in June 2013 (CB-3654), but I don't see anything for the camera itself. Not sure why that would be, but you can either add the permission to AndroidManifest.xml yourself or add a config-file directive in your project's config.xml file, for example:
<config-file target="AndroidManifest.xml" parent="/*" mode="merge">
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
</config-file>
Are you building native or hybrid app?
For native you can refer this website:
https://developer.android.com/reference/android/hardware/Camera.html

Rhomobile how to edit the Android Manifest

I am having difficulty changing the AndroidManifest.xml file.
"C:\RhoStudio\ruby\lib\ruby\gems\1.8\gems\rhodes-3.2.2\platform\android\Rhodes\AndroidManifest.xml"
I am trying to add the following to the manifest for the build to allow me to save files to the SD card:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
I add it but then when I build, the line does not appear in the AndroidManifest.xml that is outputted into the bin/tmp folder.
android:
capabilities:
- sdcard
Adding the following to the build.yml adds the above the AndroidManifest.xml and allows me to read/write to the SDcard.

Android Application is not installed

I tried signing the application and tried just debugging it. I have the Galaxy nexus. i have been able to run on the device before but now when I compile and build it shows up on the device but when i try and run it it tells me the application is not installed. I have tried to reinstall it too!
thanks
You need to add Internet permission for the app you're installing, in its manifest file, by adding the following line to the manifest file:
<uses-permission android:name="android.permission.INTERNET" />
Do this before the <application ...> tag

Categories

Resources