@amazon-devices/kepler-adid-retriever
Ad ID Retriever is a service on device that retrieves advertising ID and advertising tracking state.
Use cases:
- Retrieve the app advertising ID for bidding, reporting impressions, and reporting attributions of ads. (
fetchAdvertisingId
) - Retrieve a user's preference on interest-based advertisements. (
isAdvertisingTrackingEnabled
)
Get Started
Setup
-
Add the following library dependency to the
dependencies
section of your package.json file."@amazon-devices/kepler-adid-retriever": "~1.0.6",
-
In your manifest.toml, add the following privileges required to access Ad ID Retriever.
schema-version = 1 [package] title = "UI React Native Application to test Advertising ID" version = "1.0.0" id = "com.amazon.kepleradiddemo" [components] [[components.interactive]] id = "com.amazon.kepleradiddemo.main" runtime-module = "/com.amazon.kepler.keplerscript.runtime.loader_2@IKeplerScript_2_0" launch-type = "singleton" [wants] [[wants.service]] id = "com.amazon.admanager.service.main"
Usage
This example demonstrates how to implement the Ad ID Retriever service. The example provides a simple UI with two buttons that showcases both core functionalities: fetching the advertising ID and checking the advertising tracking status.
import {
AdIdRetriever,
} from '@amazon-devices/kepler-adid-retriever';
function doIsAdvertisingTrackingEnabled() {
const isAdTrackingEnabled: boolean = AdIdRetriever.isAdvertisingTrackingEnabled();
console.log(
'adid-js-demo: isAdTrackingEnabled = ' + isAdTrackingEnabled,
);
}
function doFetchAdvertisingId() {
const advertisingId: string = AdIdRetriever.fetchAdvertisingId();
console.log('adid-js-demo: advertisingId = ' + advertisingId);
}
export const AdIdManagerJsSampleMain = () => {
const handleIsAdvertisingTrackingEnabled = () => {
doIsAdvertisingTrackingEnabled();
};
const handleFetchAdvertisingId = () => {
doFetchAdvertisingId();
};
// Custom-made "Focusable" is a focusable button
return (
<View style={styles.container}>
<Focusable
title="isAdvertisingTrackingEnabled"
onPress={handleIsAdvertisingTrackingEnabled}
testIdLabel="isAdvertisingTrackingEnabled"
/>
<Focusable
title="fetchAdvertisingId"
onPress={handleFetchAdvertisingId}
testIdLabel="fetchAdvertisingId"
/>
</View>
);
Modules
Last updated: Sep 30, 2025