ptomasroos / react-native-idfa Goto Github PK
View Code? Open in Web Editor NEWReact native module to get advertising identifier IDFA on IOS + Android
License: MIT License
React native module to get advertising identifier IDFA on IOS + Android
License: MIT License
When using app using a sandbox app like DO Multiple Clone (https://play.google.com/store/apps/details?id=do.multiple.cloner&hl=en_IN&gl=US ) we do get different idfa.
Hi @ptomasroos please clarify the license for this package, hopefully MIT
Hello!
Trying to make a pull request but get permissions denial.
Would it be possible for you to edit build.gradle dependencies with this:
implementation "com.google.android.gms:play-services-ads:${safeExtGet('googlePlayServicesVersion', '+')}"
All the best,
Erik
When I run my app in iOS appears this error:
TypeError: undefined is not an object (evaluating 'PTRIDFA.getIDFA')
I added AdSupport.framework to Link Binary with Libraries and also I run react-native link command.
ios version: 11.3.1
I have a podfile in my project (I don't know if this file generates this error)
This will bite people eventually:
The project name '@ptomasroos/react-native-idfa' contains at least one of the following characters: [ , /, , :, <, >, ", ?, *, |]. This has been deprecated and is scheduled to be removed in Gradle 5.0. Set the 'rootProject.name' or adjust the 'include' statement (see https://docs.gradle.org/4.4/dsl/org.gradle.api.initialization.Settings.html#org.gradle.api.initialization.Settings:include(java.lang.String[]) for more details).
We noticed that the 25.2.2 build tools have been removed:
https://jcenter.bintray.com/com/android/tools/common/
Error below:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':@ptomasroos/react-native-idfa'.
> Could not resolve all files for configuration ':@ptomasroos/react-native-idfa:classpath'.
> Could not find com.android.tools:common:25.2.2.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/common/25.2.2/common-25.2.2.pom
https://jcenter.bintray.com/com/android/tools/common/25.2.2/common-25.2.2.jar
Required by:
project :@ptomasroos/react-native-idfa > com.android.tools.build:gradle:2.2.2 > com.android.tools.build:gradle-core:2.2.2 > com.android.tools.build:builder:2.2.2
project :@ptomasroos/react-native-idfa > com.android.tools.build:gradle:2.2.2 > com.android.tools.build:gradle-core:2.2.2 > com.android.tools.build:builder:2.2.2 > com.android.tools.build:manifest-merger:25.2.2
project :@ptomasroos/react-native-idfa > com.android.tools.build:gradle:2.2.2 > com.android.tools.build:gradle-core:2.2.2 > com.android.tools.build:builder:2.2.2 > com.android.tools.ddms:ddmlib:25.2.2
project :@ptomasroos/react-native-idfa > com.android.tools.build:gradle:2.2.2 > com.android.tools.build:gradle-core:2.2.2 > com.android.tools.build:builder:2.2.2 > com.android.tools.analytics-library:shared:25.2.2
project :@ptomasroos/react-native-idfa > com.android.tools.build:gradle:2.2.2 > com.android.tools.build:gradle-core:2.2.2 > com.android.tools.build:builder:2.2.2 > com.android.tools.analytics-library:tracker:25.2.2
project :@ptomasroos/react-native-idfa > com.android.tools.build:gradle:2.2.2 > com.android.tools.build:gradle-core:2.2.2 > com.android.tools.build:builder:2.2.2 > com.android.tools:sdklib:25.2.2 > com.android.tools.layoutlib:layoutlib-api:25.2.2
project :@ptomasroos/react-native-idfa > com.android.tools.build:gradle:2.2.2 > com.android.tools.build:gradle-core:2.2.2 > com.android.tools.build:builder:2.2.2 > com.android.tools:sdklib:25.2.2 > com.android.tools:dvlib:25.2.2
project :@ptomasroos/react-native-idfa > com.android.tools.build:gradle:2.2.2 > com.android.tools.build:gradle-core:2.2.2 > com.android.tools.build:builder:2.2.2 > com.android.tools:sdklib:25.2.2 > com.android.tools:repository:25.2.2
* 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 14s
Hi,
Is there a reason for disabling Bitcode?
I'm getting a linking error when trying to run on a device, that is resolved by enabling Bitcode in IDFA project.
When I rebuild and run the app, it crashes immediately.
When I run on IOS Simulator I get the typical 0000 mask and when I run it on my Iphone with the advertising option enabled I get null, using [email protected] and [email protected]
I'm getting a build error when using react-native-idfa. I'm on version ^2.0.0
, and also tried out ^4.1.0
without any luck.
Build error details:
> Task :@ptomasroos/react-native-idfa:verifyReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':@ptomasroos/react-native-idfa:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
...path/node_modules/@ptomasroos/react-native-idfa/android/build/intermediates/res/merged/release/values/values.xml:1980: error: resource android:attr/fontStyle not found.
...path/node_modules/@ptomasroos/react-native-idfa/android/build/intermediates/res/merged/release/values/values.xml:1981: error: resource android:attr/font not found.
...path/node_modules/@ptomasroos/react-native-idfa/android/build/intermediates/res/merged/release/values/values.xml:1982: error: resource android:attr/fontWeight not found.
...path/node_modules/@ptomasroos/react-native-idfa/android/build/intermediates/res/merged/release/values/values.xml:1983: error: resource android:attr/fontVariationSettings not found.
...path/node_modules/@ptomasroos/react-native-idfa/android/build/intermediates/res/merged/release/values/values.xml:1984: error: resource android:attr/ttcIndex not found.
error: failed linking references.
This is what my build.gradle
looks like:
android {
compileSdkVersion 28
defaultConfig {
...
minSdkVersion 19
targetSdkVersion 28
versionCode 52
ndk {
abiFilters "armeabi-v7a", "x86"
}
multiDexEnabled true
}
...
}
Seems like there is a method [[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled] used in getIDFA is deprecated after IOS 14. So would this module continue to work after 14, or would there be an update to address that?
Android Simulator
can you publish new release please?
That commit fix this issue 330d2a5
I realize this library is no longer maintained, but perhaps by tracking this, it will help someone else.
This library currently specifies the dependency of play-services-ads
as 'com.google.android.gms:play-services-ads:+'
. This means the version used may vary over time.
In our case, it appears the September 22, 2021 release of a play-services-ads
dependency broke our build, resulting in build errors of:
> Task :app:checkReleaseDuplicateClasses FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkReleaseDuplicateClasses'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
> Duplicate class com.google.android.gms.internal.measurement.zzbs found in modules jetified-play-services-measurement-18.0.2-runtime (com.google.android.gms:play-services-measurement:18.0.2) and jetified-play-services-measurement-sdk-api-18.0.3-runtime (com.google.android.gms:play-services-measurement-sdk-api:18.0.3)
Duplicate class com.google.android.gms.internal.measurement.zzl found in modules jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2) and jetified-play-services-measurement-sdk-api-18.0.3-runtime (com.google.android.gms:play-services-measurement-sdk-api:18.0.3)
Duplicate class com.google.android.gms.measurement.internal.zzfh found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2)
Duplicate class com.google.android.gms.measurement.internal.zzgn found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2)
Duplicate class com.google.android.gms.measurement.internal.zzgo found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2)
Duplicate class com.google.android.gms.measurement.internal.zzgp found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2)
Duplicate class com.google.android.gms.measurement.internal.zzgq found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2)
Duplicate class com.google.android.gms.measurement.internal.zzhs found in modules jetified-play-services-measurement-18.0.2-runtime (com.google.android.gms:play-services-measurement:18.0.2) and jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3)
Duplicate class com.google.android.gms.measurement.internal.zzhx found in modules jetified-play-services-measurement-base-18.0.3-runtime (com.google.android.gms:play-services-measurement-base:18.0.3) and jetified-play-services-measurement-impl-18.0.2-runtime (com.google.android.gms:play-services-measurement-impl:18.0.2)
Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>.
By using patch-package
to set the play-services-ads
version to 17.2.1
, we are building again (and shouldn't break from this library in the future).
Optimally, this library should also defer to a safeExtGet
for a playServicesVersion
specified in the client build.gradle
.
Hello,
The react-native-idfa
documentation is a bit unclear regarding the Permissions for iOS 14.
Would it be possible to update the README.md
to include how to get the permissions? I had to install an additional library into my project to do so.
Alternatively, can this library itself maybe eventually also include the permissions request?
I am getting null IDFAs for 50% of my clients. Any idea?
All iOS
Please upload your new releases to npm. They are not available there. Version 3.0.1
is the newest there: https://www.npmjs.com/package/@ptomasroos/react-native-idfa
Hello, I just found out that my IDFA in IOS 14 is empty from getIDFA() and I already done extra steps for IOS 14 the Track permission prompt show and granted but idfa still empty from the function. How can I workaround this issue please suggest
Thank you
I recently installed this package using yarn add react-native-idfa
followed by react-native link react-native-idfa
When trying to run android I'm getting this error:
> Task :app:transformClassesWithDexBuilderForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/douglaswalker/.gradle/caches/transforms-1/files-1.1/play-services-measurement-base-16.3.0.aar/e108b7e4f665f7a61dd3e8c95e4299d2/jars/classes.jar
* 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 17s
I tried adding the code below to top-level build.gradle but that didn't seem to help.
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.getRequested().getGroup() == 'com.google.android.gms') {
// If different projects require different versions of
// Google Play Services it causes a crash on run.
// Fix by overriding version for all projects.
details.useVersion('17.0.0')
}
}
}
My app/build.gradle dependencies list looks like this:
dependencies {
implementation project(':react-native-idfa')
implementation project(':react-native-sound')
implementation(project(':react-native-localize'))
implementation 'com.android.support:multidex:1.0.3'
implementation(project(':react-native-appsflyer'))
implementation(project(':react-native-firebase'))
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.android.gms:play-services-base:16.0.1'
implementation 'com.google.android.gms:play-services-stats:16.0.1'
implementation(project(':react-native-restart'))
implementation(project(':react-native-fs'))
implementation(project(':react-native-linear-gradient'))
implementation(project(':react-native-fast-image'))
implementation(project(':react-native-audio'))
implementation 'com.swrve.sdk.android:swrve-firebase:6.0.2'
implementation 'com.facebook.fresco:fresco:1.10.0'
implementation 'com.facebook.fresco:animated-gif:1.10.0'
implementation(project(':react-native-webview'))
implementation(project(':react-native-image-crop-picker'))
implementation(project(':react-native-device-info'))
implementation(project(':react-native-splash-screen'))
implementation(project(':react-native-config'))
implementation(project(':react-native-auth0'))
implementation(project(':react-native-gesture-handler'))
implementation(project(':react-native-vector-icons'))
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:support-v4:27.1.1"
implementation "com.facebook.react:react-native:+" // From node_modules
}
and top-level build.gradle looks like this:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.1'
}
}
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 18
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
jcenter{
url = 'https://dl.bintray.com/swrve-inc/android'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven { url "https://jitpack.io" }
}
}
Has anyone fixed this issue and can help me out?
Thanks in advance!
Edit:
Looks like excluding the group from dependency causing version conflict solved my issue.
implementation (project(':react-native-advertising-id')) {
exclude group:'com.google.android.gms'
}
Android now builds successfully!
ANDROID: I get package com.PTR.IDFA does not exist
, any ideas why? (after linking and compiling)
Could it be related to all these warnings due to the existence of older code in the library?
Building and installing the app on the device (cd android && gradlew.bat installMainDebug)...
The project name '@ptomasroos/react-native-idfa' contains at least one of the following chara
cters: [ , /, \, :, <, >, ", ?, *, |]. This has been deprecated and is scheduled to be remove
d in Gradle 5.0. Set the 'rootProject.name' or adjust the 'include' statement (see https://do
cs.gradle.org/4.4/dsl/org.gradle.api.initialization.Settings.html#org.gradle.api.initializati
on.Settings:include(java.lang.String[]) for more details).
> Configure project :@ptomasroos/react-native-idfa
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and
'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools
/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (25.0.0) is ignored, as it is below th
e minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.0'" from your build.gradle file, as
each version of the Android Gradle Plugin now has a default version of the build tools.
> Configure project :app
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'debugCompile' is obsolete and has been replaced with 'debugImplementa
tion' and 'debugApi'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools
/update-dependency-configurations.html
WARNING: Configuration 'releaseCompile' is obsolete and has been replaced with 'releaseImplem
entation' and 'releaseApi'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools
/update-dependency-configurations.html
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and
'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools
/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below th
e minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.2'" from your build.gradle file, as
each version of the Android Gradle Plugin now has a default version of the build tools.
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Thanks!
Hello, I need to support Android SDK 16 on an app using this library? Is there a particularu reason for minSdkVersion 21
?
If you collect the IDFA you need to collect tracking enabled, right? Or is that no longer a requirement?
I got this error, however, I added the code where we force to use ver 17.0.0
Process: com.pushnotification, PID: 15131
java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: java.lang.IllegalStateException:
******************************************************************************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
* should follow the instructions here: https://goo.gl/fQ2neu to add a valid *
* App ID inside the AndroidManifest. Google Ad Manager publishers should *
* follow instructions here: https://goo.gl/h17b6x. *
******************************************************************************
The entire android/build
directory is published to npm.
I think we should put it in the .npmignore file.
The package size is 40M+ currently, which is not good.
"react-native": "0.68.6"
"react-native-idfa": "4.0.4",
Since RN 0.48 AdSupportIOS
and it is recommended to use this plugin (see here
But so far this plugin does not seem to be compatible with this RN version.
Problem:
Getting dependency issues with other libraries that use google mobile services:
com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzas;
Solution:
Change react-native-idfa/android/build.gradle
to pull in latest version of play-services-ads
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.