With this module you are able to get advertising identifier in your React Native project.
npm install react-native-advertising-infoWith this module you are able to get advertising identifier in your React Native project.
(IDFA for iOS, and AAID for Android)


``sh`
yarn add react-native-advertising-infoor
npm install react-native-advertising-info
- iOS:
`sh`
cd ios && pod install
`swift`
// Info.plist
#### getAdvertisingInfo
`tsx
import { getAdvertisingInfo } from 'react-native-advertising-info'
React.useEffect(() => {
getAdvertisingInfo().then((adInfo) => console.log(adInfo))
}, [])
`
or
#### useAdTrackingInfo
`tsx
import { useAdTrackingInfo } from 'react-native-advertising-info'
const adInfo = useAdTrackingInfo()
`
`ts
// Response
type AdvertisingInfo = {
adTrackingEnabled: boolean
advertisingId: string
status: TrackingStatus
}
// TrackingStatus
type TrackingStatus = 'Authorized' | 'Denied' | 'Not Determined' | 'Restricted' | 'Unknown' | 'Not Required'
`
#### adTrackingEnabled
- true: status Authorized or Not required
- false: different status
#### advertisingId
Phone advertising identifier. Empty string if tracking not enabled
#### status
For Android devices the request prompt isn't required and status is either:
- Not Required - defaultDenied
- - A user has blocked tracking globally in phone settings
For iOS < 14 the request prompt isn't required and the status is Not Required`
For iOS >= 14 the request prompt is required. The status can be one of these values
MIT
See the contributing guide to learn how to contribute to the repository and the development workflow.