privacy-sandbox-samples
privacy-sandbox-samples copied to clipboard
Trying to retrieve AD_ID in SDK Runtime
When I'm running the below piece of code on onLoadSDK()
inSandboxedSdkProvider
extended class
private void testAdId() {
AdIdManager adIdManager = getContext().getSystemService(AdIdManager.class);
adIdManager.getAdId(Runnable::run, new OutcomeReceiver<AdId, Exception>() {
@Override
public void onResult(@NonNull AdId adId) {
Log.d("SDK Runtime", "SDK Runtime.testAdId onResult Adid: " + adId);
}
@Override
public void onError(@NonNull Exception error) {
Log.e("SDK Runtime", "SDK Runtime.testAdId onError " + error.getMessage());
}
});
}
This is being printed in the console
2022-10-04 01:09:39.174 10282-10301 SDK Runtime com.google.android.sdksandbox E
SDK Runtime.testAdId onError Caller is not authorized to call this API. Permission was not requested.
How can I get AD_ID
in SDK Runtime as of now is there any way?
Thanks for reaching out to us!
This error is displayed as the caller doesn't have the permission to call AD_ID.
Did you add following in your manifest file?
<uses-permission android:name="android.permission.ACCESS_ADSERVICES_AD_ID" />
@siran-work which permission you are referring to exactly?
@hellosagar
<uses-permission android:name="android.permission.ACCESS_ADSERVICES_AD_ID" />
This permission is already added to the manifest of SDK and Example app
, still facing the error mentioned above
![Screenshot 2022-10-11 at 12 03 26 PM](https://user-images.githubusercontent.com/50016799/195013501-db6d7801-3552-493a-a9b5-79e44ab5e094.png)
You were using the UI to install the SDK correct? That actually won't use the sdk-app (and something we are looking to clarify in our sample code). It actually just uses the example-sdk
project to pull in the right dependencies. Can you try adding the permission to the sdk-implementation
module and let me know if that resolves your issue?
https://github.com/android/privacy-sandbox-samples/blob/main/PrivacySandboxJava/sdk-implementation/src/main/AndroidManifest.xml
Still the same error
onError Caller is not authorized to call this API. Permission was not requested.
Thanks for trying. I've tested this a bit and am able to repro. There may be an issue with how SDKs are being generated using the Canary instructions and passing permissions defined in the manifest along. I'll need to follow up with some other folks to debug this further. So no immediate answer (other than if you try using the Stable Android Studio instructions and install the sdk as an app, but going forward this method will not be supported but might be able to unblock your immediate testing), so I will follow up with you when I know more
Turns out you found a bug! Appreciate you testing things out. This will be fixed in the next release, so I'll circle back when that goes out to confirm the resolution of the problem.
@hellosagar we published a new version of the TiramisuPrivacySandbox SDK. Can you update to revision 8 and see if your issue is resolved?
@cshmerling sure, I'll give it a shot
@cshmerling when ARM image will be released for revision 8?
![Screenshot 2022-10-31 at 10 43 14 PM](https://user-images.githubusercontent.com/50016799/199068068-6f4456c4-6c91-4cc2-8b45-8e9694e06edd.png)
Its available now- see the "Update Available". Click the - button and it'll download
Sorry where can I update?
The box next to the ARM image
After updating the project, unable to build the project
Executing tasks: [:example-aidl-library:clean, :client-app:clean, :sdk-implementation:clean, :example-aidl-library:assembleOemDebug, :client-app:assembleOemDebug, :client-app:buildPrivacySandboxSdkApksForOemDebug, :sdk-implementation:assembleOemDebug] in project /Users/sagarkhurana/AndroidStudioProjects/privacy-sandbox-samples/PrivacySandboxKotlin
> Configure project :client-app
AGPBI: {"kind":"warning","text":"The option setting 'android.experimental.privacysandboxsdk.enable=true' is experimental.\nThe current default is 'false'.","sources":[{}]}
Disabling ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM option because PRIVACY_SANDBOX_SDK_SUPPORT is set. This is not supported by ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM yet.
Disabling ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM option because PRIVACY_SANDBOX_SDK_SUPPORT is set. This is not supported by ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM yet.
Disabling ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM option because PRIVACY_SANDBOX_SDK_SUPPORT is set. This is not supported by ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM yet.
> Configure project :example-aidl-library
Disabling ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM option because PRIVACY_SANDBOX_SDK_SUPPORT is set. This is not supported by ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM yet.
Disabling ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM option because PRIVACY_SANDBOX_SDK_SUPPORT is set. This is not supported by ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM yet.
Disabling ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM option because PRIVACY_SANDBOX_SDK_SUPPORT is set. This is not supported by ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM yet.
> Configure project :sdk-implementation
Disabling ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM option because PRIVACY_SANDBOX_SDK_SUPPORT is set. This is not supported by ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM yet.
Disabling ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM option because PRIVACY_SANDBOX_SDK_SUPPORT is set. This is not supported by ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM yet.
Disabling ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM option because PRIVACY_SANDBOX_SDK_SUPPORT is set. This is not supported by ANDROID_TEST_USES_UNIFIED_TEST_PLATFORM yet.
> Task :example-aidl-library:clean UP-TO-DATE
> Task :client-app:clean UP-TO-DATE
> Task :sdk-implementation:clean UP-TO-DATE
> Task :example-aidl-library:reportBuildAnalyzerIssues
> Task :example-aidl-library:preBuild
> Task :example-aidl-library:preOemDebugBuild
> Task :example-aidl-library:mergeOemDebugJniLibFolders
> Task :example-aidl-library:mergeOemDebugNativeLibs NO-SOURCE
> Task :example-aidl-library:stripOemDebugDebugSymbols NO-SOURCE
> Task :example-aidl-library:copyOemDebugJniLibsProjectAndLocalJars
> Task :example-aidl-library:generateOemDebugResValues
> Task :example-aidl-library:extractDeepLinksForAarOemDebug UP-TO-DATE
> Task :example-aidl-library:generateOemDebugBuildConfig
> Task :example-aidl-library:generateOemDebugResources
> Task :example-aidl-library:packageOemDebugResources
> Task :example-aidl-library:parseOemDebugLocalResources
> Task :example-aidl-library:javaPreCompileOemDebug
> Task :example-aidl-library:processOemDebugManifest
> Task :example-aidl-library:mergeOemDebugShaders
> Task :example-aidl-library:compileOemDebugShaders NO-SOURCE
> Task :example-aidl-library:generateOemDebugAssets UP-TO-DATE
> Task :example-aidl-library:generateOemDebugRFile
> Task :example-aidl-library:packageOemDebugAssets
> Task :example-aidl-library:extractOemDebugAnnotations
> Task :example-aidl-library:compileOemDebugJavaWithJavac
> Task :example-aidl-library:mergeOemDebugGeneratedProguardFiles UP-TO-DATE
> Task :example-aidl-library:mergeOemDebugConsumerProguardFiles UP-TO-DATE
> Task :example-aidl-library:prepareLintJarForPublish UP-TO-DATE
> Task :example-aidl-library:prepareOemDebugArtProfile UP-TO-DATE
> Task :example-aidl-library:processOemDebugJavaRes NO-SOURCE
> Task :example-aidl-library:mergeOemDebugJavaResource
> Task :example-aidl-library:writeOemDebugAarMetadata
> Task :example-aidl-library:syncOemDebugLibJars
> Task :example-aidl-library:bundleOemDebugAar
> Task :example-aidl-library:createOemDebugVariantModel
> Task :example-aidl-library:assembleOemDebug
> Task :client-app:createOemDebugVariantModel
> Task :client-app:reportBuildAnalyzerIssues
> Task :client-app:preBuild
> Task :client-app:preOemDebugBuild
> Task :client-app:mergeOemDebugNativeDebugMetadata NO-SOURCE
> Task :client-app:generateOemDebugBuildConfig
> Task :client-app:generateOemDebugResValues
> Task :client-app:checkOemDebugAarMetadata
> Task :client-app:mapOemDebugSourceSetPaths
> Task :client-app:generateOemDebugResources
> Task :client-app:packageOemDebugResources
> Task :client-app:createOemDebugCompatibleScreenManifests
> Task :client-app:extractDeepLinksOemDebug
> Task :example-aidl-library:extractDeepLinksOemDebug
> Task :client-app:parseOemDebugLocalResources
> Task :client-app:processOemDebugMainManifest
> Task :client-app:processOemDebugManifest
> Task :example-sdk:generateRPackageDex UP-TO-DATE
> Task :example-aidl-library:prePreviewDebugBuild
> Task :example-aidl-library:generatePreviewDebugResValues
> Task :example-aidl-library:generatePreviewDebugResources
> Task :example-aidl-library:packagePreviewDebugResources
> Task :sdk-implementation:reportBuildAnalyzerIssues
> Task :sdk-implementation:preBuild
> Task :sdk-implementation:prePreviewDebugBuild
> Task :sdk-implementation:generatePreviewDebugResValues
> Task :sdk-implementation:generatePreviewDebugResources
> Task :sdk-implementation:packagePreviewDebugResources
> Task :example-sdk:mergeAndCompileResources UP-TO-DATE
> Task :example-sdk:mainManifestGenerator UP-TO-DATE
> Task :example-aidl-library:processPreviewDebugManifest
> Task :example-aidl-library:generatePreviewDebugBuildConfig
> Task :sdk-implementation:processPreviewDebugManifest
> Task :example-sdk:mergeManifest UP-TO-DATE
> Task :example-sdk:linkPrivacySandboxResources UP-TO-DATE
> Task :example-aidl-library:parsePreviewDebugLocalResources
> Task :example-aidl-library:javaPreCompilePreviewDebug
> Task :sdk-implementation:parsePreviewDebugLocalResources
> Task :sdk-implementation:generatePreviewDebugBuildConfig
> Task :example-aidl-library:generatePreviewDebugRFile
> Task :sdk-implementation:generatePreviewDebugRFile
> Task :example-aidl-library:compilePreviewDebugJavaWithJavac
> Task :example-sdk:generateRClass UP-TO-DATE
> Task :example-aidl-library:bundleLibRuntimeToJarPreviewDebug
> Task :example-aidl-library:bundleLibCompileToJarPreviewDebug
> Task :sdk-implementation:javaPreCompilePreviewDebug
> Task :example-aidl-library:processPreviewDebugJavaRes NO-SOURCE
> Task :client-app:mergeOemDebugResources
> Task :example-aidl-library:bundleLibResPreviewDebug NO-SOURCE
> Task :sdk-implementation:processPreviewDebugJavaRes NO-SOURCE
> Task :example-aidl-library:mergePreviewDebugShaders
> Task :example-aidl-library:compilePreviewDebugShaders NO-SOURCE
> Task :example-aidl-library:generatePreviewDebugAssets UP-TO-DATE
> Task :example-aidl-library:packagePreviewDebugAssets
> Task :sdk-implementation:mergePreviewDebugShaders
> Task :sdk-implementation:compilePreviewDebugShaders NO-SOURCE
> Task :sdk-implementation:generatePreviewDebugAssets UP-TO-DATE
> Task :sdk-implementation:packagePreviewDebugAssets
> Task :example-sdk:mergingArtifactASSETS UP-TO-DATE
> Task :example-sdk:writeAppMetadata UP-TO-DATE
> Task :example-sdk:validatePrivacySandboxSdkSigning UP-TO-DATE
> Task :example-aidl-library:compileOemDebugLibraryResources
> Task :example-aidl-library:bundleLibCompileToJarOemDebug
> Task :client-app:javaPreCompileOemDebug
> Task :client-app:mergeOemDebugShaders
> Task :client-app:compileOemDebugShaders NO-SOURCE
> Task :client-app:generateOemDebugAssets UP-TO-DATE
> Task :client-app:mergeOemDebugAssets
> Task :client-app:compressOemDebugAssets
> Task :client-app:desugarOemDebugFileDependencies
> Task :client-app:processOemDebugJavaRes NO-SOURCE
> Task :example-aidl-library:bundleLibResOemDebug NO-SOURCE
> Task :client-app:checkOemDebugDuplicateClasses
> Task :example-aidl-library:bundleLibRuntimeToDirOemDebug
> Task :client-app:generateOemDebugFeatureMetadata
> Task :client-app:mergeOemDebugJniLibFolders
> Task :example-aidl-library:copyOemDebugJniLibsProjectOnly
> Task :client-app:validateSigningOemDebug
> Task :client-app:mergeOemDebugNativeLibs NO-SOURCE
> Task :client-app:stripOemDebugDebugSymbols NO-SOURCE
> Task :client-app:writeOemDebugAppMetadata
> Task :client-app:writeOemDebugSigningConfigVersions
> Task :sdk-implementation:preOemDebugBuild
> Task :client-app:mergeLibDexOemDebug
> Task :sdk-implementation:mergeOemDebugJniLibFolders
> Task :sdk-implementation:mergeOemDebugNativeLibs NO-SOURCE
> Task :sdk-implementation:stripOemDebugDebugSymbols NO-SOURCE
> Task :sdk-implementation:copyOemDebugJniLibsProjectAndLocalJars
> Task :sdk-implementation:generateOemDebugResValues
> Task :sdk-implementation:extractDeepLinksForAarOemDebug UP-TO-DATE
> Task :sdk-implementation:generateOemDebugBuildConfig
> Task :sdk-implementation:generateOemDebugResources
> Task :sdk-implementation:packageOemDebugResources
> Task :sdk-implementation:parseOemDebugLocalResources
> Task :sdk-implementation:javaPreCompileOemDebug
> Task :sdk-implementation:processOemDebugManifest
> Task :sdk-implementation:mergeOemDebugShaders
> Task :sdk-implementation:compileOemDebugShaders NO-SOURCE
> Task :sdk-implementation:generateOemDebugAssets UP-TO-DATE
> Task :sdk-implementation:packageOemDebugAssets
> Task :sdk-implementation:prepareLintJarForPublish UP-TO-DATE
> Task :sdk-implementation:generateOemDebugRFile
> Task :sdk-implementation:prepareOemDebugArtProfile UP-TO-DATE
> Task :sdk-implementation:processOemDebugJavaRes NO-SOURCE
> Task :sdk-implementation:writeOemDebugAarMetadata
> Task :sdk-implementation:createOemDebugVariantModel
> Task :sdk-implementation:compilePreviewDebugKotlin FAILED
e: /Users/sagarkhurana/AndroidStudioProjects/privacy-sandbox-samples/PrivacySandboxKotlin/sdk-implementation/src/main/java/com/example/sdkimplementation/SdkApi.kt: (20, 20): Unresolved reference: exampleaidllibrary
e: /Users/sagarkhurana/AndroidStudioProjects/privacy-sandbox-samples/PrivacySandboxKotlin/sdk-implementation/src/main/java/com/example/sdkimplementation/SdkApi.kt: (27, 37): Unresolved reference: ISdkApi
e: /Users/sagarkhurana/AndroidStudioProjects/privacy-sandbox-samples/PrivacySandboxKotlin/sdk-implementation/src/main/java/com/example/sdkimplementation/SdkApi.kt: (35, 5): 'createFile' overrides nothing
e: /Users/sagarkhurana/AndroidStudioProjects/privacy-sandbox-samples/PrivacySandboxKotlin/sdk-implementation/src/main/java/com/example/sdkimplementation/SdkProviderImpl.kt: (36, 29): Type mismatch: inferred type is SdkApi but IBinder was expected
> Task :sdk-implementation:compileOemDebugKotlin FAILED
e: /Users/sagarkhurana/AndroidStudioProjects/privacy-sandbox-samples/PrivacySandboxKotlin/sdk-implementation/src/main/java/com/example/sdkimplementation/SdkApi.kt: (20, 20): Unresolved reference: exampleaidllibrary
e: /Users/sagarkhurana/AndroidStudioProjects/privacy-sandbox-samples/PrivacySandboxKotlin/sdk-implementation/src/main/java/com/example/sdkimplementation/SdkApi.kt: (27, 37): Unresolved reference: ISdkApi
e: /Users/sagarkhurana/AndroidStudioProjects/privacy-sandbox-samples/PrivacySandboxKotlin/sdk-implementation/src/main/java/com/example/sdkimplementation/SdkApi.kt: (35, 5): 'createFile' overrides nothing
e: /Users/sagarkhurana/AndroidStudioProjects/privacy-sandbox-samples/PrivacySandboxKotlin/sdk-implementation/src/main/java/com/example/sdkimplementation/SdkProviderImpl.kt: (36, 29): Type mismatch: inferred type is SdkApi but IBinder was expected
> Task :client-app:mergeExtDexOemDebug
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':sdk-implementation:compilePreviewDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':sdk-implementation:compileOemDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
107 actionable tasks: 87 executed, 20 up-to-date
Looks like there are some issues with the latest Android Studio not enabling some build features. I'll need to create a PR to update the files, but in the meantime, to unblock you:
in example-aidl-library/build.gradle, add
buildFeatures {
aidl = true
}
at the end of the file
@cshmerling this error was fixed and the app is installed.
But in an android studio, it's showing only client-app
whereas previously it showed sdk-app
as well in the list to install the sdk-app
first and then client-app
![Screenshot 2022-11-07 at 7 28 01 PM](https://user-images.githubusercontent.com/50016799/200328228-ced8cd01-fefd-4a47-a318-e9204d091350.png)
So, now I've installed the client-app using the UI and since I don't where to install the SDK. On click on load SDK in the app its not loading the SDK and showing the following error message
![Screenshot 2022-11-07 at 7 30 33 PM](https://user-images.githubusercontent.com/50016799/200328722-1e13b0c8-7bc4-4ae3-a5c5-09ef744b7442.png)
Can you please assist from here Thanks
sdk-app being removed is expected, as that is not actually needed to install an SDK. SDK installation should happen automatically since you are using Canary Android Studio.
The issue is some feature flags controlling access to the runtime got introduced that we missed documenting. You'll need to run:
adb shell device_config put adservices global_kill_switch false
adb shell device_config put adservices disable_sdk_sandbox false
from a terminal before launching the client app
So, I just ran the commands that you mentioned and still SDK is not loading. Following logs is being generated
2022-11-08 12:25:38.080 11886-11886 studio.deploy installer E Could not get package user id: run-as: unknown package: com.example.privacysandbox.client
2022-11-08 12:25:38.085 11886-11886 studio.deploy installer E Could not find apks for this package: com.example.privacysandbox.client
2022-11-08 12:25:38.092 11886-11886 studio.deploy installer E Could not get package user id: run-as: unknown package: com.example.privacysandbox.client
2022-11-08 12:25:38.098 11886-11886 studio.deploy installer E Could not find apks for this package: com.example.privacysandbox.client
2022-11-08 12:25:38.603 553-599 VerityUtils system_server E Failed to measure fs-verity, errno 1: /data/app/~~e0HjwHVSVKvxclDnyDXL7Q==/com.example.privacysandbox.client-cv184y6UWMy7TouSjwLxOw==/base.apk
2022-11-08 12:25:43.226 14479-14500 EGL_emulation com.example.privacysandbox.client D app_time_stats: avg=376.41ms min=1.11ms max=3776.36ms count=11
2022-11-08 12:25:43.280 14479-14479 SandboxClient com.example.privacysandbox.client E Attempting to load sandbox SDK
2022-11-08 12:25:43.383 14479-14498 SandboxClient com.example.privacysandbox.client E onLoadSdkFailure(103): null
2022-11-08 12:25:43.383 14479-14479 CompatibilityChangeReporter com.example.privacysandbox.client D Compat change id reported: 147798919; UID 10163; state: ENABLED
and right now I'm using the following version of android studio
Android Studio Flamingo | 2022.2.1 Canary 6
Build #AI-222.4345.14.2221.9189903, built on October 18, 2022
Runtime version: 17.0.4.1+0-17.0.4.1b469.62-9127311 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 10
Metal Rendering is ON
Registry:
analyze.exceptions.on.the.fly=true
external.system.auto.import.disabled=true
ide.text.editor.with.preview.show.floating.toolbar=false
ide.instant.shutdown=false
Non-Bundled Plugins:
wu.seal.tool.jsontokotlin (3.7.4)
some.awesome (1.14)
de.netnexus.camelcaseplugin (3.0.12)
google-java-format (1.15.0.0)
com.github.setial (4.0.2)
com.github.copilot (1.1.34.2009)
com.facebook.ktfmt_idea_plugin (1.1.0.41)
VisualVMLauncher (1.21.211.6085.0)
Gradle View (4.0.0)
com.chuntung.plugin.gistsnippet (1.1.0)
zielu.gittoolbox (212.9.9)
com.developerphil.adbidea (1.6.8)
com.thelumiereguy.compose_helper (2.0.3)
@cshmerling,
I'm trying to retrieve the AdId
and AppSetId
, but I keep getting exceptions.
Caller is not authorized to call this API. Caller is not allowed.
I'm using Canary 8 to run my app.
@pazlavi assuming you did everything as described in the release notes about this, we did find out there were some additional permissions being checked to enable access to Privacy Sandbox APIs. We updated the instructions specifically mentioning enabling the Sandbox via the UI:
adb shell am start -n com.google.android.adservices.api/com.android.adservices.ui.settings.AdServicesSettingsActivity
Can you confirm that you have done all that? If the issue still persists, please capture an adb bugreport
and share it with us via our IssueTracker
@cshmerling
Unfortunately, it didn't help. I opened a bug report with adb bugreport
output on Issue Tracker
Thanks for the detailed issue. I'm forwarding it to the right people to take a look. The only other thing I might suggest is after enabling the Privacy Sandbox would be to reboot the device before trying to run the app as that has resolved some other issues, but you can also just wait for a response to the bug you filed as well
Thanks @cshmerling for forwarding the issue.
Rebooting the device didn't help here.
I'm curious why the issue is already closed as won't fix
as it is clear that the SecurityException
is thrown from your internal AdServicesStatusUtils
class.
I think some wires got crossed by our support team- I've reopened the issue and we will look in to it
It looks like there were several issues- one permission issue and once that was resolved a new issue arose that the AdId returned was not useable. For the latter issue, we confirmed that these are known limitations. The getAdId and getAppSetId APIs do not work properly yet as we have not fully completed the required rollouts. Please stay tuned.
Hey, Do you happen to have any news regarding this issue? Updating that it reproduces consistently for me when using the sampleApp locally.
I'm using a pixel4 emulator with TiramisuPrivacySandbox SDK revision 9, running with arm image.
When running the registerSource
or registerTrigger
methods, I'm getting the following:
D/adservices: registerSource
E/adservices: Failed to get Ad ID: java.lang.SecurityException: Caller is not authorized to call this API. Caller is not allowed.
D/adservices: registerTrigger
E/adservices: Failed to get Ad ID: java.lang.SecurityException: Caller is not authorized to call this API. Caller is not allowed.
I'm using the following permissions in the app manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_ADSERVICES_ATTRIBUTION" />
<uses-permission android:name="android.permission.ACCESS_ADSERVICES_AUDIENCES" />
<uses-permission android:name="android.permission.ACCESS_ADSERVICES_TOPICS" />
<uses-permission android:name="android.permission.ACCESS_ADSERVICES_AD_ID" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
And I have the following ad_services_config.xml file configured:
<ad-services-config>
<ad-id allowAllToAccess="true"/>
<attribution allowAllToAccess="true" />
<includes-sdk-library allowAllToAccess="true" />
<topics allowAllToAccess="true" />
<custom-audiences allowAllToAccess="true" />
</ad-services-config>
and the following configs are set on the emulator device_config:
adid_kill_switch=false
adservice_enable_status=true
adservice_enabled=true
adservice_system_service_enabled=true
disable_sdk_sandbox=false
global_kill_switch=false
ppapi_app_allow_list="*"
ppapi_app_signature_allow_list="*"
I even added our enrollment link to the mdd_measurement_manifest_file_url
config, although I assume it doesn't affect the local run.
in a locally generated bugreport (which I can submit to the issue tracker if necessary) I can see the following log lines:
./bugreport-sdk_gphone64_arm64-TRA7.230112.001.C4-2023-02-21-01-23-50.txt:69616:02-20 17:14:48.748 10162 12674 12674 D adservices: registerSource
./bugreport-sdk_gphone64_arm64-TRA7.230112.001.C4-2023-02-21-01-23-50.txt:69628:02-20 17:14:48.766 10150 12066 12738 E adservices: Failed to find resolveInfo for adServices service. Intent action: android.adservices.adid.AdIdProviderService
./bugreport-sdk_gphone64_arm64-TRA7.230112.001.C4-2023-02-21-01-23-50.txt:69629:02-20 17:14:48.766 10150 12066 12738 E adservices: Failed to find AdServices service
./bugreport-sdk_gphone64_arm64-TRA7.230112.001.C4-2023-02-21-01-23-50.txt:69630:02-20 17:14:48.768 10150 12066 12066 E adservices: Measurement API is disabled
./bugreport-sdk_gphone64_arm64-TRA7.230112.001.C4-2023-02-21-01-23-50.txt:69631:02-20 17:14:48.768 10150 12066 12066 E adservices: Measurement API is disabled
Will be happy to hear your thoughts on the matter @cshmerling :)
Hi @yuvalcar,
Apologies for the delay - are you still seeing this issue?
If you are,
Caller is not allowed
generally means there is an issue with the allowlist. I would try deleting your current allowlist with adb shell device_config delete adservices ppapi_app_allow_list
and entering your package name with adb shell device_config put adservices ppapi_app_allow_list [package name]
. If you are using the Measurement sample app, you don't need to set the allowlist at all, as com.example.measurement.sampleapp
is included by default.
For Measurement API is disabled
, try making sure the kill switches are off by running these commands:
-
adb shell device_config put adservices adid_kill_switch false
-
adb shell device_config put adservices measurement_kill_switch false
Let us know if you're still seeing issues!
hey @erintwalsh, Yeah, I'm still getting the same issue, as for your request I opened an issue in the issue tracker.
Currently getting the following:
2023-05-17 11:53:33.120 10013-10013 adservices com.example.measurement.sampleapp D registerSource
2023-05-17 11:53:33.129 574-2369 ActivityManager system_server D sync unfroze 4990 com.google.android.adservices.api
2023-05-17 11:53:33.291 4990-4998 .adservices.api com.google.android.adservices.api W Reducing the number of considered missed Gc histogram windows from 176 to 100
2023-05-17 11:53:33.309 4990-5015 adservices com.google.android.adservices.api E Caller is not authorized.
while using the following adservices device config:
adid_kill_switch=false
adservice_enabled=true
adservice_system_service_enabled=true
appsetid_kill_switch=true
back_compact_test_param=false
disable_fledge_enrollment_check=true
disable_sdk_sandbox=false
enable_appsearch_consent_data=false
enable_back_compat=false
enable_database_schema_version_5=true
enable_database_schema_version_7=true
enable_test_param=false
enable_topic_contributors_check=true
enrollment_blocklist_ids=
eu_notif_flow_change_enabled=false
fledge_ad_selection_bidding_timeout_per_ca_ms=5000
fledge_ad_selection_concurrent_bidding_count=6
fledge_ad_selection_enforce_foreground_status_ad_selection_override=true
fledge_ad_selection_enforce_foreground_status_custom_audience=true
fledge_ad_selection_enforce_foreground_status_report_impression=true
fledge_ad_selection_enforce_foreground_status_run_ad_selection=true
fledge_ad_selection_overall_timeout_ms=10000
fledge_ad_selection_scoring_timeout_ms=5000
fledge_background_fetch_eligible_update_base_interval_s=86400
fledge_background_fetch_enabled=true
fledge_background_fetch_job_flex_ms=1800000
fledge_background_fetch_job_max_runtime_ms=600000
fledge_background_fetch_job_period_ms=14400000
fledge_background_fetch_max_num_updated=1000
fledge_background_fetch_max_response_size_b=10240
fledge_background_fetch_network_connect_timeout_ms=5000
fledge_background_fetch_network_read_timeout_ms=30000
fledge_background_fetch_thread_pool_size=8
fledge_custom_audience_active_time_window_ms=5184000000
fledge_custom_audience_default_expire_in_days=5184000000
fledge_custom_audience_max_activate_in_days=5184000000
fledge_custom_audience_max_ads_size_b=10240
fledge_custom_audience_max_bidding_logic_uri_size_b=400
fledge_custom_audience_max_count=4000
fledge_custom_audience_max_daily_update_uri_size_b=400
fledge_custom_audience_max_expire_in_days=5184000000
fledge_custom_audience_max_name_size_b=200
fledge_custom_audience_max_num_ads=100
fledge_custom_audience_max_owner_count=1000
fledge_custom_audience_max_trusted_bidding_data_size_b=10240
fledge_custom_audience_max_user_bidding_signals_size_b=10240
fledge_custom_audience_per_app_max_count=1000
fledge_custom_audience_service_kill_switch=true
fledge_js_isolate_enforce_max_heap_size=false
fledge_js_isolate_max_heap_size_bytes=10485760
fledge_report_impression_overall_timeout_ms=2000
fledge_select_ads_kill_switch=true
foreground_validation_status_level=125
ga_ux_enabled=false
global_kill_switch=false
is_eea_device=false
is_eea_device_feature_enabled=true
mdd_android_sharing_sample_interval=100
mdd_api_logging_sample_interval=100
mdd_background_task_kill_switch=false
mdd_cellular_charging_gcm_task_period_seconds=21600
mdd_charging_gcm_task_period_seconds=21600
mdd_default_sample_interval=1
mdd_download_events_sample_interval=1
mdd_group_stats_logging_sample_interval=1
mdd_logger_kill_switch=false
mdd_maintenance_gcm_task_period_seconds=86400
mdd_measurement_manifest_file_url="MANIFEST_URL_PROVIDED_BY_GOOGLE"
mdd_mobstore_file_service_stats_sample_interval=100
mdd_network_stats_logging_sample_interval=100
mdd_storage_stats_logging_sample_interval=1
mdd_topics_classifier_manifest_file_url=https://www.gstatic.com/mdi-serving/rubidium-adservices-topics-classifier/1467/80c34503413cea9ea44cbe94cd38dabc44ea8d70
mdd_ui_ota_strings_manifest_file_url=https://www.gstatic.com/mdi-serving/rubidium-adservices-ui-ota-strings/1341/95580b00edbd8cbf62bfa0df9ebd79fba1e5b7ca
mdd_wifi_charging_gcm_task_period_seconds=21600
measurement_api_delete_registrations_kill_switch=false
measurement_api_register_source_kill_switch=false
measurement_api_register_trigger_kill_switch=false
measurement_api_register_web_source_kill_switch=false
measurement_api_register_web_trigger_kill_switch=false
measurement_api_status_kill_switch=false
measurement_job_aggregate_fallback_reporting_kill_switch=false
measurement_job_aggregate_reporting_kill_switch=false
measurement_job_attribution_kill_switch=false
measurement_job_delete_expired_kill_switch=false
measurement_job_event_fallback_reporting_kill_switch=false
measurement_job_event_reporting_kill_switch=false
measurement_kill_switch=false
measurement_receiver_delete_packages_kill_switch=false
measurement_receiver_install_attribution_kill_switch=false
ppapi_app_allow_list="com.example.measurement.sampleapp"
ppapi_app_signature_allow_list="com.example.measurement.sampleapp"
sdksandbox_customized_sdk_context_enabled=false
topics_epoch_job_flex_ms=18000000
topics_epoch_job_period_ms=604800000
topics_kill_switch=true
topics_number_of_lookback_epochs=3
topics_number_of_random_topics=1
topics_number_of_top_topics=5
topics_on_device_classifier_kill_switch=false
topics_percentage_for_random_topics=5
ui_dialogs_feature_enabled=false
ui_eea_countries=AT,BE,BG,HR,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IE,IT,LV,LT,LU,MT,NL,PL,PT,RO,SK,SI,ES,SE,IS,LI,NO,CH,GB,GI,GP,GG,JE,VA,AX,IC,EA,GF,PF,TF,MQ,YT,NC,RE,BL,MF,PM,SJ,WF
ui_ota_strings_download_deadline=86700000
ui_ota_strings_feature_enabled=false
web_context_client_allow_list=com.google.android.googlequicksearchbox,com.android.chrome,com.chrome.beta,com.chrome.dev,com.chrome.canary,
The sample app and an emulator image (Android API 34, UpsideDownCake, arm64). Are you sure it's only the ppapi config? is there any other config I should set differently? maybe another permission?