android-permissions

Grant Uri permission to another activity

房东的猫 提交于 2019-12-04 04:43:10
I'm trying to get image from device gallery and then show it in another activity. Code in my activity: private void startGallery() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("image/*"); startActivityForResult(intent, REQ_OPEN_GALLERY) } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQ_OPEN_GALLERY && resultCode == Activity.RESULT_OK) { Uri imageUri = data.getData() // here I save image uri to pass to another activity } } When I try to open uri in another

java.lang.RuntimeException: start failed

我只是一个虾纸丫 提交于 2019-12-04 03:49:58
I am trying to record audio in one of my Activities using MediaRecorder. Part of the code is shown below. File file = new File(AppConstants.MSGS_DIR, filename); MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(AudioSource.MIC); recorder.setOutputFormat(OutputFormat.THREE_GPP); recorder.setAudioEncoder(AudioEncoder.AMR_WB); recorder.setOutputFile(file.getAbsolutePath()); try { recorder.prepare(); recorder.start(); } catch (IOException e) { System.out.println("Exception: " + e.getMessage()); } I've given the following permissions in manifest file. <uses-permission android

Getting W/Activity: Can request only one set of permissions at a time

拟墨画扇 提交于 2019-12-04 03:04:05
I made an app that have a request for camera and GPS, but when I execute I am getting this warning several times with less than 1 second of each other. W/Activity: Can reqeust only one set of permissions at a time) Can some one tell me why? @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); mStatusCamera = intent.getStringExtra("camera"); mScannerView = new ZXingScannerView(this) { @Override protected IViewFinder createViewFinderView(Context context) { return new CustomZXingScannerView(context); } }; List

android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@c745883 - permission denied

喜夏-厌秋 提交于 2019-12-04 01:01:38
Here's my stack trace: 01-30 15:11:41.037 13010-13010/project.app E/AndroidRuntime: FATAL EXCEPTION: main Process: project.app, PID: 13010 android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@c745883 -- permission denied for window type 2003 at android.view.ViewRootImpl.setView(ViewRootImpl.java:789) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:356) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93) at android.app.Dialog.show(Dialog.java:330) at com.facebook.react.devsupport.DevSupportManagerImpl$4.run

Android Marshmallow permission model on OS 4.0 READ_EXTERNAL_STORAGE permission always not granted

风格不统一 提交于 2019-12-04 00:55:54
I have a problem when running my app on Android OS 4.0 and requesting READ_EXTERNAL_STORAGE permission with: ActivityCompat.requestPermissions(ctx, requestedPermissions, requestCode); I always get on the callback public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { grantResults != PackageManager.PERMISSION_GRANTED Checking the permission with ActivityCompat.checkSelfPermission is always returning permissionDenied . It works well on OS 6.0 by requesting the permission with system dialog. Android OS 4.x excepted the 4.0 the

Lacking privileges to access camera service in Android 6.0

岁酱吖の 提交于 2019-12-04 00:16:23
I am using Camera2API in Android 6.0. I was done without error in Android 5.0. However, when I used my code in the Android 6.0, I have a issue. The issue is that sometime I can open the camera successfully and take picture. However, sometime the camera cannot open and it has error java.lang.SecurityException: Lacking privileges to access camera service at android.hardware.camera2.utils.CameraBinderDecorator.throwOnError(CameraBinderDecorator.java:108) I added the runtime permission as follows: String[] PERMISSIONS = {Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL

Android M permissions close my app

二次信任 提交于 2019-12-03 23:36:07
I check for the required permissions on my Log In screen. The dialog shows asking for the 4 permissions I need. All good, but when the dialog appears, the background becomes black and my app closes (doesn't crash, just closes). When I'm done with choosing the permissions I open the app again and it continues running from where it stopped. How can I make the app continue running while the permissions dialog is shown? I use a class which checks for permissions and call it in the Log In activity. The class: public abstract class RuntimePermissionsActivity extends AppCompatActivity { private

Can I remove this permission? (It cause INSTALL_FAILED_DUPLICATE_PERMISSION in Android 5.0 device)

a 夏天 提交于 2019-12-03 21:53:28
问题 My tester said that he couldn't install the app from Play Store to his Nexus 5 (Lollipop). He said he got this error Unknown error code during application install “-505” I took his phone and try to install the app via adb, I got this error Failure [INSTALL_FAILED_DUPLICATE_PERMISSION perm=com.example.gcm.permission.C2D_MESSAGE pkg=com.mailchimp.alterego] After some reading, I came across this writing from @Commonsware http://commonsware.com/blog/2014/08/04/custom-permission-vulnerability-l

How to add extra permission to a prebuilt application (no source code) in AOSP

和自甴很熟 提交于 2019-12-03 21:34:10
问题 I have an application that doesn't have a specific android permission(for example android.permission.CHANGE_CONFIGURATION ). I don't have its source code. I'm working on an AOSP. I prebuilt this application like: Put APK in /device/model/apps/HERE Add these snippet codes in Android.mk: define PREBUILT_templateByMe LOCAL_MODULE := $(1) LOCAL_MODULE_CLASS := APPS LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) LOCAL_CERTIFICATE := PRESIGNED LOCAL_SRC_FILES := $$(LOCAL_MODULE).apk LOCAL

How to detect permission access of other apps?

柔情痞子 提交于 2019-12-03 20:52:46
I'm searching for a way to detect permission usage of other apps. The key idea is to detect, when other apps are accessing media or sensors (e.g. microphone). I want to implement a service, which is looking for any permission usages, so that the service can inform the user, once any app is accessing the microphone or camera. Does anybody know how to do this? I already found out, that I can read all granted permission of an app using the PackageManager, but I'm more interested in "real" permission usage. Thanks in advance! I think detecting permission requests isn't possible in that way. Since