So I was wondering if there is a rule against having more than one "uses-permission" block in my app. EX:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
when I use this in my app, it crashes as soon as i click the button.
NOTE: my button saves a file to the SD card and uploads it to FTP (that's where i'm stuck - adding the internet part)
any thoughts?
It can be as many uses-permissions in a manifest file as required by an application.
You can use-permissions in a Manifest files as per your Requirement , its show the user when it download or install your application then Ask user to require permissions given permissions before Application use.
Related
During the development of the application, we encountered a problem. We connect a USB flash drive to the device via OTG cable. We request access rights from the user, but in the end we get nothing.
As a result, we started looking at what the path to Total Commander looks like. It looks something like this:
enter image description here
As a result, we realized that the system hides the file. Please tell me what permissions are needed so that you can access the flash drive files directly.
We tried to write simple Java code to display the contents of the folder on the screen, but we couldn't find the way to our flash drive.
String path = new File(Objects.requireNonNull(Environment.getExternalStorageDirectory().getParent())).getParent();
Tested on several devices, we noticed that only 2 flash drives are displayed and have access to them, since they are displayed on the path /storage/emulated/0, on the rest there is no and we will change the path ///USB_.
The permission we gave:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.USB_PERMISSION" />
!API 29!
I have forked an Android application on Github (https://github.com/android/location-samples/tree/master/BasicLocation) which demonstrates use of Google Play services Location API to get the last known location for a device.
However, when I try and run the application, I receive a Toast message that states "No location detected. Make sure location is enabled on the device."
I have added the following permissions to the Manifest:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
In addition, the Extended controls of the emulator reads my current lat/long coordinates
I was wondering how I can resolve this issue.
Run the google map app and give it all the permissions and after the map show start your app.
check this one for more inf.
Emulator's Location simulation not working
I want Users READ_CONTACTS and ACCESS_NETWORK_STATE Permission For my app if i Declare this permission On Manifest my app gets Rejected by google play
Manifest file:
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS"
/>
I am using This Code to get network info
ConnectivityManager cm = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo();
boolean networkState = activeNetworkInfo != null && activeNetworkInfo.isConnected();
if i remove the permission from manifest file "cm.getActiveNetworkInfo()" this shows error "you need to add permission on Manifest file"
Is Their any other way than manifest file to get the users permission
Kindly help me on this.
It is not possible to request permissions without declaring them in the manifest.
Instead of focusing on removing the permission declarations in the manifest, focus on why Google Play has rejected the app and try to fix the issue.
According to official documentation you must declare permissions in manifest file. You are facing some other issues regarding app submission
Your manifest tells the device and the Play store about your app. You cannot try to skip that. If you really don't need those permissions then don't use it. Otherwise, make an appeal in your Play console if your app has been stopped.
Edit: Read this about Manifest and Google Android Developer Documentation.
I have uploaded an application to google play, but it doesn't ask for permissions on install for some reason.
I have these permissions in my AndroidManifest.xml:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
You can manually add these permissions via settings on the phone, other permissions do not show up, so I guess app is done correctly, though memory permission is disabled by default and user has to manually enable it.
Most likely, your module has its targetSdkVersion set to 23 or higher. In that case, permissions with a protectionLevel of dangerous — such as the two you are requesting — not only have to appear in the manifest, but have to be requested at runtime.
I am developing an app that needs direct access to the root folder of the sdcard, however it seems in Android 4.2, the standard /sdcard directory now points to an "emulated" sdcard specific to the user running the app. This is not good, as my app requires access to a file that is stored on the top level of the sdcard. Does anyone know how to directly access the sdcard in Android 4.2?
Perhaps I am misunderstanding your question, however, with my Nexus Galaxy running Android 4.2.1 I can access my sd card using Environment.getExternalStorageDirectory(). The returned directory is /storage/emulated/0, but the content is that of /sdcard.
Can you use the storage directory as a File type? (java.io.File)
If so, you can get the external storage (Typically SD card, but will be main storage on phones with no SD card) by using code such as this in your method:
File path = Environment.getExternalStorageDirectory();
Additionally, access of storage requires READ_EXTERNAL_STORAGE permission in your Android Manifest - with WRITE_EXTERNAL_STORAGE being needed if any data is modified. Here are these permissions as they would appear in the manifest:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Sources:
http://developer.android.com/reference/android/os/Environment.html
http://developer.android.com/reference/android/Manifest.permission.html