Shoutem - Add location permission in custom extension - android

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>

Related

Unable to read external storage in Xamarin.Forms for Android

In the Xamarin.Forms application we are developing, called "myApp", targeting Android devices only, we need to be able to read from (and possibly write to) the text file
storage/emulated/0/Android/data/com.myApp.configuration/myAppStuff.txt
which in the Windows 10 development platform appears as
This PC\DEVICE TYPE\Internal shared storage\Android\data\com.myApp.configuration\
In the AndroidManifest.xml file for the project, we have included
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" ... >
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:remove="android:maxSdkVersion"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:remove="android:maxSdkVersion"/>
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" tools:remove="android:maxSdkVersion"/>
</manifest>
This is confirmed in Visual Studio 2022 by navigating to
Project > myApp.Android Properties > Android Manifest > Required permissions:
and observing the required permissions are asserted.
When the application is first started in the debug mode, in MainActivity.cs
AndroidX.Core.App.ActivityCompat.CheckSelfPermission(this, Android.Manifest.Permission.ReadExternalStorage)
returns "false", so we invoke
AndroidX.Core.App.ActivityCompat.RequestPermissions(this, new string[] { Android.Manifest.Permission.ReadExternalStorage, Android.Manifest.Permission.WriteExternalStorage, Android.Manifest.Permission.ManageExternalStorage }, 0)
Android shows a (non-modal) dialog
for which we select "ALLOW".
Later, the code
File.Exists("/storage/emulated/0/Android/data/com.myApp.configuration/myAppStuff.txt")
returns "true"
but the code
mystreamreader = new StreamReader("/storage/emulated/0/Android/data/com.myApp.configuration/myAppStuff.txt");
throws the exception with Message value of
"Access to the path \"/storage/emulated/0/Android/data/com.myApp.configuration/myAppStuff.txt\" is denied."
A later check shows that the code
AndroidX.Core.App.ActivityCompat.CheckSelfPermission(this, Android.Manifest.Permission.ManageExternalStorage)
returns the value "false".
Why?
I can't reproduce your problem. But you said:
we need to be able to read from (and possibly write to) the text file
So I created a sample to read and write the text file:
In my AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0"
             package="com.companyname.app21">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
<application android:label="App21.Android" android:theme="#style/MainTheme"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
Please make sure the package's value in your AndroidManifest.xml file is com.myApp.configuration.
And the code about create, read and write the file:
FileStream filestream = new FileStream("/storage/emulated/0/Android/data/com.companyname.app21/test.txt",
FileMode.OpenOrCreate,
FileAccess.ReadWrite,
FileShare.ReadWrite);
// create the text file
File.WriteAllText("/storage/emulated/0/Android/data/com.companyname.app21/test.txt", "this is content");
// write the text file
var content = File.ReadAllText("/storage/emulated/0/Android/data/com.companyname.app21/test.txt");
//read the text file
Which Android version? As of Android13, EXTERNAL_STORAGE is basically gone. CheckSelfPermission for it will auto-answer false, just as if you answered "No and do not ask again" before. They want you to move to different APIs, e.g. ask a Document Picker to get arbitrary files or be a Document Provider to provide them.

Instabug: Disable user location tracking

My team uses the Instabug APK on Android (and iOS) and we'd like to disable user location tracking since we don't need it. I can't find anywhere how to do so.
How does Instabug even track the user's location to begin with? Our app doesn't have any location permissions.
Libraries add automatically the permissions they need. Final manifest file is a merge of your app's manifest file and all libraries'.
You can check the merged manifest by using Android Studio > AndroidManifest.xml > Merged Manifest tab
or
ANDROID_SDK_PATH/build-tools/28.0.3/aapt d permissions yourApp.apk
You can remove the location permission by adding tools:node="remove".
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="remove" />
https://developer.android.com/studio/build/manage-manifests

Getting internet permission in flutter app

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>

Can tinyXML-1 open files on Android?

TinyXML-1 can't open file. File exist on that path, but xmlDoc.ErrorDesc() writes Failed to open file. Can tinyXML1 open files on android or I must use Tinyxml2?
What is the exact error on your logcat?
It can be just that you didn't put the required permission:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
In your AndroidManifest.xml

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.

Categories

Resources