I do not understand what is going on here.
I get permission denied try trying to access External Storage on HTC Wildfire S although i set
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
in the manifest file.
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state))
return false.
File storage= new File(Environment.getExternalStorageDirectory(),FILENAME);
By calling storage.createNewFile(); i get permission denied.
Stacktrace: java.io.IOException: Permission denied
NOTE: The same application is working correctly on all Android Samsung devices. I have the problem only on HTC and Sony devices
Thanks for your help
Is your device plugged in your PC (USB) ? Did you check the status of your SDCard (how it is mounted, USB options while plugged in) ?
For this error : java.io.IOException: Permission denied
The destination file may aldready exist. Did you check that ?
I get the anwser by myself.
Quiet simple: i just use internal storage instead of
External one.
Related
Well, I have built an app to store values on a remote database. It works!! I didn't use an emulator for testing instead I used my own phone. Now the problem is that on my phone, it works perfectly...no issues but when I installed it on another phone, the app doesn't connect to the internet.
I have included internet permission in android manifest.xml.
I have tried these but didn't work:
Building apk and installing in the new phone.
Compiling directly to the new phone.
Sending the apk from old phone to new phone via shareit.
Creating a signed apk and installing.
Checked via wifi and mobile data (NOTE: BOTH WIFI AND MOBILE DATA WORKS IN OLD PHONE).
Checked android compatibility: supports up to android 10.
*I added error messages for try...catch blocks in form of toasts for the user to know what's the issue. and the catch exception for no internet returns connection problem. I'm getting that error message.
As I researched, I got to know that internet permission is categorized as normal permission which is not prompted to the user upon installation.
I built a second dummy app: Same issue with it... compiled directly to new phone but didn't work...it works in old phone...
Old phone: Samsung J7 Prime with Android 8.1
New Phone: Samsung J7 Pro with Android 9
Any idea or suggestion will be gladly helpful... Thank you!
in android 9 and above you have to set network Security Config
first of all in res package create xml package and in xml package create new xml resource file with network_security_config name
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
then in manifest in
android:networkSecurityConfig="#xml/network_security_config"
<uses-permission android:name="android.permission.INTERNET" />
Use debug APK instead of signed APK
please add permission on Manifest to give a permission of permission.INTERNET
Does anyone know of a way to retrieve the Device ID found under Settings -> About tablet -> System updates -> Software update settings under the Device information header in Android versions 4.x or 5.x?
Agreed with #G.hakim , but additional to that, this API requires android.permission.READ_PHONE_STATE permission.So you need to declare the permission in AndroidManifest.xml if you want to use this api:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
If i'm not wrong you are looking for your mobile phone's device id which you can get using these line of code
TelephonyManager tm = (TelephonyManager)context.GetSystemService(Context.TelephonyService);
deviceId = tm.DeviceId;
Also requires the following permission:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Also after Android Marshmallow Or API 23 you need to ask for permissions on the fly the code reference for that can be found here:
https://blog.xamarin.com/requesting-runtime-permissions-in-android-marshmallow/
Well I'm trying to access my webapp from my android emulator device an exception is throwing: java.net.SocketException: socket failed: EACCES (Permission denied)
In browser all right:
Browser access from http://192.168.25.7:8080
But When I try to access it from my app:
App code and thrown exception
How should I make it work?
Note: I'm using Tomcat 9, vraptor to webapp and eclipse to android programming.
use: http://10.0.2.2:8080 instead to access your pc's localhost from the emulator
Please make sure you have config permission to access network in AndroidManifest.xml.For example:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
But you first change your IP like MoQ's suggestion.
java.lang.SecurityException: Permission Denial: starting Intent {
act=android.intent.action.CALL dat=tel:xxxxxxxxxx
cmp=com.android.server.telecom/.components.UserCallActivity } from
ProcessRecord{9a25695 2469:in.preciseit.dialhingoli/u0a59} (pid=2469,
uid=10059) with revoked permission android.permission.CALL_PHONE
here is what i want to ask in Logcat error
I am using call function onClicklistener.
+
please define following permission in menifest file and Try. And then after not work then Read This url for marshmallow runtime permission
<uses-permission android:name="android.permission.CALL_PHONE"/>
Android 6 (SDK 23) allows users to revoke permissions from an app.
Click to read more
Iam getting this error on my log
07-06 06:22:07.419: ERROR/AndroidRuntime(2618): java.lang.SecurityException: SECURE PERMISSION: Neither user 10070 nor current process has android.permission.WRITE_SECURE_SETTINGS.
I used like this
in activity file
private static final String SECURE_SETTINGS = android.Manifest.permission.WRITE_SECURE_SETTINGS;
mContext.enforceCallingOrSelfPermission(SECURE_SETTINGS,
"BLUETOOTH_ADMIN permission");
in manifest file
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
Why does it give error?
The WRITE_SECURE_SETTINGS permission is not available to apps which aren't part of the firmware because secure settings are designed to be secured against modification by third party apps.
You can only read this settings if your phone doesn't have root access. To enable bluetooth you can use this references http://developer.android.com/guide/topics/wireless/bluetooth.html.
However, this is above sdk5... I'm not really sure if it is a good idea to use bluetooth with sdk3. I also wanted to do an app which uses bluetooth and I had to switch my target level to above 2.0.1 because bluetooth below this sdk is not supported very well.