I'm using the Gmail API to send emails from an Android app.
Reading about GET_ACCOUNTS permission lead me to think it's no longer necessary but apparently, I was wrong.
I personally use Android 8 and everything is working just fine without the permission declared, however, running Android 7 raises an exception from the Google GMS Auth lib: (I know, the exception doesn't look related, it is the permission issue)
java.lang.IllegalArgumentException: the name must not be empty: null
at android.accounts.Account.<init>(Account.java:48)
at com.google.android.gms.auth.zzd.getToken(Unknown Source)
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential.getToken(GoogleAccountCredential.java:267)
at com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential$RequestHandler.intercept(GoogleAccountCredential.java:292)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:868)
at com.google.api.client.googleapis.media.MediaHttpUploader.executeCurrentRequestWithoutGZip(MediaHttpUploader.java:545)
at com.google.api.client.googleapis.media.MediaHttpUploader.executeCurrentRequest(MediaHttpUploader.java:562)
at com.google.api.client.googleapis.media.MediaHttpUploader.executeUploadInitiation(MediaHttpUploader.java:519)
at com.google.api.client.googleapis.media.MediaHttpUploader.resumableUpload(MediaHttpUploader.java:384)
at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:336)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:427)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
So I guess I still need to declare it and ask the user to grant it on Android 7, but in what other SDK versions?
It looks like Android 8 doesn't need the permission, but what about Android 6 downwards?
I've looked all over the Google API's doc's but didn't find anything related...
Related
I am trying to run Espresso tests on Android bundle uploaded to firebase testlab. I have also included the firebase Screenshotter library. I get the following errors in firebase test lab:
09-18 05:22:13.937: E/cloud_screenshotter(18993): Exception taking screenshot: java.io.FileNotFoundException: /sdcard/screenshots/com.augustinus.fcmtest.LoggedInTests-haveVideoCallScreen-CallNotification-1.jpg: open failed: ENOENT (No such file or directory)
I already have storage permissions and this shows up at the start of logs:
09-18 02:51:37.784: I/GrantPermissionCallable(18946): Permission: android.permission.READ_EXTERNAL_STORAGE is already granted!
09-18 02:51:37.785: I/GrantPermissionCallable(18946): Permission: android.permission.WRITE_EXTERNAL_STORAGE is already granted!
09-18 02:51:37.785: I/GrantPermissionCallable(18946): Permission: android.permission.READ_EXTERNAL_STORAGE is already granted!
The device used is a physical device. Pixel 4, API Level 29
UPDATE:
Have tested again and can confirm the issue exists on Api level 29 but not Api Level 28. On APi Level 29 (Android 10) there have been some changes to how accessing storage works. Accessing the shared media folders is different. Very likely Firebase ScreenShotter has not been updated to cope with API level 29.
Ideally Google Firebase needs to udpate their ScreenShotter library to work with API Level 29. As a short term solution you can add the following in your AndroidManifest.xml
<application
android:requestLegacyExternalStorage="true"
I'm trying read text message from Android RCS Message Apps (Google / Samsung)
What I was trying
set permission concerned with rcs
com.samsung.rcs.im.READ_PERMISSION (samsung galaxy series)
com.gsma.rcs.permission.RCS (google)
But, I got this exception.
Caused by: java.lang.SecurityException: Permission Denial: opening provider com.sec.internal.tapi.service.provider.HistoryLogProvider from ProcessRecord{e7c133 3845:com.gilapps.rcstest/u0a240} (pid=3845, uid=10240) requires com.gsma.services.permission.RCS or com.sec.imsservice.WRITE_IMS_PERMISSION
I'm guessing that maybe permission with RCS is still signature level permission.
Am I Right?
I'm getting the following error when calling Camera.open(cameraIndex) (Camera 1 API)
MethodInvocationProxy : Exception while calling method public abstract boolean android.media.IAudioService.isCameraSoundForced() throws android.os.RemoteException
java.lang.SecurityException: Method class android.media.IAudioService$Stub$Proxy.isCameraSoundForced[] not available to instant apps
06-18 10:23:43.361 26240-26359/? E/Isotope: UID: [10185] PID: [26240]
MethodInvocationStub : Exception while calling method
isCameraSoundForced
java.lang.SecurityException: Method class
android.media.IAudioService$Stub$Proxy.isCameraSoundForced[] not
available to instant apps
at com.google.android.instantapps.supervisor.ipc.proxies.SandboxEnforcer.enforceUnsupportedPolicy(PG:63)
at com.google.android.instantapps.supervisor.ipc.proxies.SandboxEnforcer.enforceUnsupportedMethodPolicy(PG:17)
at com.google.android.instantapps.supervisor.ipc.ProxyMethodHandler.handleMethod(PG:50)
at com.google.android.instantapps.supervisor.ipc.base.MethodInvocationStub.onTransact(PG:56)
at android.os.Binder.execTransact(Binder.java:453) 06-18 10:23:43.361
26274-26274/? E/Isotope: UID: [99000] PID: [26274]
MethodInvocationProxy : Exception while calling method public abstract
boolean android.media.IAudioService.isCameraSoundForced() throws
android.os.RemoteException
java.lang.SecurityException: Method class
android.media.IAudioService$Stub$Proxy.isCameraSoundForced[] not
available to instant apps
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at com.google.android.instantapps.supervisor.ipc.base.MethodInvocationProxy.readReply(PG:39)
at com.google.android.instantapps.supervisor.ipc.base.MethodInvocationProxy.invoke(PG:130)
at java.lang.reflect.Proxy.invoke(Proxy.java:393)
at $Proxy5.isCameraSoundForced(Unknown Source)
at android.hardware.Camera.getCameraInfo(Camera.java:260)
at com.chegg.feature.wizard.camera.CameraActivity.getBackFacingCamera(CameraActivity.java:357)
at com.chegg.feature.wizard.camera.CameraActivity.startCamera(CameraActivity.java:101)
at com.chegg.feature.wizard.camera.CameraActivity.startCameraSafely(CameraActivity.java:79)
at com.chegg.feature.wizard.camera.CameraActivity.onResume(CameraActivity.java:74)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1286)
at android.app.Activity.performResume(Activity.java:6987)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4144)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3360)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
android.hardware.Camera was deprecated in API level 21, while Instant Apps support devices only from API level 23. You need to use android.hardware.camera2 instead.
https://developer.android.com/reference/android/hardware/camera2/package-summary.html
The android.hardware.camera2 package provides an interface to
individual camera devices connected to an Android device. It replaces
the deprecated Camera class.
This issue was addressed in https://issuetracker.google.com/issues/38485484
where Engineers provided the following information:
"Instant apps don't support the old deprecated android.hardware.Camera. They only support the camera2 APIs"
Instant apps have restricted functionality, obviously that method is not supported. You can use InstantApps.isInstantApp() method to determine whether it is installed or instant app and call isCameraSoundForced only for installed.
More info: https://developer.android.com/topic/instant-apps/reference.html
Instant apps run natively on Android O and on previous versions, they use google play services to run. So camera 1 is not supported in instant apps prior to API 26 as they don't run natively. However, you can use Camera 1 api in an instant app on API 26 and till the time Camera 1 api lives I would imagine.
However, I'm using camera 2 api in the instant app and camera 1 api in the installed app.
This is a bug in the current implementation of Google Play Services support of instant apps.
It will be fixed in a future release, at which point the android.hardware.Camera API should function correctly.
Unfortunately I don't have any specifics on the timeframe of the fix being available.
A few days ago Crashlytics startet reporting weird crashes within my Google Play Services Location API Implementation. After the Google Play Services API is connected I try to get the last known location with FusedLocationApi.getLastLocation(...) but this call ends in a Security Exception telling me I don't have the right permission to do that (see stack trace below)
I do have the runtime permissions and this code is working on most devices for a few months. This error occurs mainly on the OnePlus One and I could repoduce it on a HTC One M8 with Android 6.
I think the problem is related to the latest google play services update but I could not validate this. This error occurs only if the devices location services are disabled (which actually automatically removes the location permission from google play services) so I think the newest play services on these devices have a bug that throws the security exception cause the google play services do not have the permission to access location data although my app does.
Is anyone experiencing a similar problem and maybe had found a better solution then try{}catch the whole thing or any update from google about the issue?
UPDATE:
I could test this again on HTC One M8 with Android 6.0 and the SecurityException is also thrown with enabled location services and grantet permissions to the app and the play services.
Switching between BALANCED_POWER AND HIGH_ACCURACY has no effect except chaning the exception message to
Client must have ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION
permission to perform any location operations.
File access Permission has no issues and my fallback implementation which useses the Android LocationManager throws no SecurityException but the location is only determined when location services set to gps only.
Interessting fact: Google Play Services crash every few seconds when using Google Maps and no location can be found. Only navigation, which enables gps can find the location.
In summary
The HTC One M8 (Android 6.0 Software Nr. 6.12.401.4) with Google Play Services 9.2.56 (438-124593566) has a general problem with Location services which are not gps only. The Google Play Services FusedLocationApi has an issue with the permission system cause the permissions are given but it throws a SecurityException. Using old LocationManager implementation has no security issues but can only determine the location if device settings are set to gps only.
The Stacktrace:
Fatal Exception: java.lang.SecurityException: Client must have ACCESS_FINE_LOCATION permission to request PRIORITY_HIGH_ACCURACY locations.
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at com.google.android.gms.location.internal.zzi$zza$zza.zza(Unknown Source)
at com.google.android.gms.location.internal.zzk.getLastLocation(Unknown Source)
at com.google.android.gms.location.internal.zzl.getLastLocation(Unknown Source)
at com.google.android.gms.location.internal.zzd$1.zza(Unknown Source)
at com.google.android.gms.location.internal.zzd$1.zza(Unknown Source)
at com.google.android.gms.internal.zznt$zza.zzre(Unknown Source)
at com.google.android.gms.internal.zzoc.connect(Unknown Source)
at com.google.android.gms.internal.zzoc.zzd(Unknown Source)
at com.google.android.gms.internal.zzoh.zzd(Unknown Source)
at com.google.android.gms.internal.zzof.zzd(Unknown Source)
at com.google.android.gms.location.internal.zzd.getLastLocation(Unknown Source)
at com.my.package.location.PlayServicesLocationFinder.onConnected(PlayServicesLocationFinder.java:74)
at com.google.android.gms.common.internal.zzl.zztI(Unknown Source)
at com.google.android.gms.internal.zzof.zzc(Unknown Source)
at com.google.android.gms.internal.zzod.zzsb(Unknown Source)
at com.google.android.gms.internal.zzod.begin(Unknown Source)
at com.google.android.gms.internal.zzoh.zzc(Unknown Source)
at com.google.android.gms.internal.zznw.onConnected(Unknown Source)
at com.google.android.gms.common.internal.zzk$1.onConnected(Unknown Source)
at com.google.android.gms.common.internal.zzd$zzj.zzl(Unknown Source)
at com.google.android.gms.common.internal.zzd$zza.zztp(Unknown Source)
at com.google.android.gms.common.internal.zzd$zza.zztp(Unknown Source)
at com.google.android.gms.common.internal.zzd$zze.zztr(Unknown Source)
at com.google.android.gms.common.internal.zzd$zzd.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5461)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
should be fixed now, in Play Services 9.6 https://developers.google.com/maps/documentation/android-api/releases#september_21_2016
September 21, 2016
Resolved Issues
Client must have ACCESS_FINE_LOCATION permission to request PRIORITY_HIGH_ACCURACY locations. (Issue 10166)
I am having an issue with sqlite db in Android. But as I made a quick research on the internet, I suspect that the problem is not related to sqlite but system user. My app is not recognized as authorized user to access db functionalities. I tried to apply possible suggested solutions in stack overflow but none of them made a difference. This is the LogCat I am facing every time I attempt to use db functionality.
12-14 02:35:17.721 2953-3355/? E/DatabaseUtils﹕ Writing exception to parcel
java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13082)
at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2038)
at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:577)
at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
at android.os.Binder.execTransact(Binder.java:388)
at dalvik.system.NativeStart.run(Native Method)
I tried to add permission
android.permission.INTERACT_ACROSS_USERS_FULL
but still no sound. The strange thing is when I try to add INTERNET permission Android Studio 0.3 (ide I use) suggests me possible permissions I can choose. But when it comes to INTERACT_ACROSS_USERS_FULL permission it behaves like it has no idea about this permission. My test device is Samsung S4 running on 4.3.
I assume that I am not the only one who tries to use db on android. So there is a solution.
How can I really add INTERACT_ACROSS_USERS_FULL permission to my application?
According to this answer: android.permission.INTERACT_ACROSS_USERS_FULL is a signature level permission. Your app will not be able to use it until and unless it has the same signature as the system.
Which is not something you can achieve unless you either are the creator or the system build, or collaborating with them such that they are willing to sign your apk with their certificate. In other words, this is off limits for most developers.
I got the error android.permission.INTERACT_ACROSS_USERS_FULL because I had some conflicts in the bin directory of the project. I did some changes to the my app package id and the app-file-1.apk in the bin directory doesn't match with the project.
I did a project > clean and checked that the bin folder was cleared and regenerated, and it works now.
I had the same issue and think that I can help you out. I had registered my app with my production keystore, but was using Eclipse debug to load it into my phone. The Eclipse debug uses debug.keystore which wont match the signature of your production key and throw this error. Use the debug keystore instead for testing or send the apk to yourself and download it onto your phone.
I get this error when I change my minSdkVersion from 8 to 11 in my Manifest. I changed it back to 8 or 9 and no more error.
Try changing your minSdkVersion in your manifest. I was able to repeat the crash and error results with versions 10, 11, and 12 (my app crashes and displays "requires android.permission.INTERACT_ACROSS_USERS_FULL" in the LogCat)
Try to disable auto-fill. It works 100% on Android Oreo. Check this link
Simply add this code to your app :
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
window.decorView.importantForAutofill =
View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS;
}