birgernass / react-native-ad-consent Goto Github PK
View Code? Open in Web Editor NEWGoogle's User Messaging Platform (UMP SDK) for React Native.
License: MIT License
Google's User Messaging Platform (UMP SDK) for React Native.
License: MIT License
I've followed the installation steps for iOS, and running my app on the iOS simulator, I get the following upon start:
TypeError: null is not an object (evaluating '_reactNativeAdConsent.default.requestConsenfInfoUpdate')
I have copied & pasted the example code for asking for consent into my App.js like this:
import RNAdConsent from 'react-native-ad-consent';
[...]
const consentStatus = await RNAdConsent.requestConsentInfoUpdate({ publisherId: "myID" });
if (consentStatus === RNAdConsent.UNKNOWN) {
const formResponse = await RNAdConsent.showGoogleConsentForm({
privacyPolicyUrl: "https://your-privacy-link.com",
shouldOfferAdFree: false
});
if (formResponse === RNAdConsent.PREFERS_AD_FREE) {
// do stuff
} else {
await RNAdConsent.setConsentStatus(formResponse)
}
}
I have edited AppDelegate.h/.m as advised, and also edited the Info.plist.
I also tried pod install
in ios folder, althought not given by the instruction, which tells me:
skipped the react-native dependency 'react-native-ad-consent'. No podspec file was found.
In addition I have added PersonalizedAdConsent
via pod but it did not help.
So in fact
import RNAdConsent from 'react-native-ad-consent';
returns null
.
What do I have to do?
Hello,
The example is using privacyUrl but it should be privacyPolicyUrl. This error does not crash the app but the consent form will not show up.
// Incorrect:
const formResponse = await RNAdConsent.showGoogleConsentForm({
privacyUrl: "https://your-privacy-link.com",
shouldOfferAdFree: true,
})
// Correct:
const formResponse = await RNAdConsent.showGoogleConsentForm({
privacyPolicyUrl: "https://your-privacy-link.com",
shouldOfferAdFree: true,
})
Is there any option to change the language (support localization) in the consent form or edit the text from it?
Thanks a lot in advance!
Hi,
First of all, thanks for open-sourcing this package :) very handy!
Is there, by any chance, a possibility to open the privacy url with for example react-native-inappbrowser?
Otherwise, I think that App Store review will complain.
Getting a bunch of compilation errors on a new react-native project. All seem to be coming from compilation errors on "boost-for-react-native" project.
Steps to repro:-
react-native init AdmobConsentTest
npm install react-native-ad-consent --save
react-native link react-native-ad-consent
pod 'PersonalizedAdConsent'
pod 'Google-Mobile-Ads-SDK'
4.b. Add the following key to your project's Info.plist
GADIsAdManagerApp
4.c. Add the following initalization code to your project's AppDelegate.h:
#import <GoogleMobileAds/GoogleMobileAds.h>
4.d. Add the following initalization code to your project's AppDelegate.m
[GADMobileAds configureWithApplicationID:@"ca-app-pub-xxxxxx~xxxxx"];
Execution failed for task ':react-native-ad-consent:mergeDebugShaders'.
> Failed to create directory '\node_modules\react-native-ad-consent\android\build\intermediates\incremental\mergeDebugShaders'
I used debug but still got the error :
isConsentFormAvailable = false
isRequestLocationInEeaOrUnknown = false
So, as far as I gathered, if we use the UMP from google and we request consent using their Form, we no longer need to use this boolean "requestNonPersonalizedAdsOnly" with Admob libraries, because anything is managed directly from Google system.
Can someone confirm this?
react-native: 0.63
react-native-ad-consent: 4.0.0 (I also tried 3.0.0)
I'm guessing this is due to the fact that I'm using that I have a managed Expo project? If so, I guess there's no choice but to eject...
This package is working really well
But today I got this rejection from the App store review.
The message:
We noticed your app includes a GDPR prompt and an App Tracking Transparency permission request, but they are implemented in a way that might confuse the user.
Specifically, your app shows the App Tracking Transparency permission request after the user has already requested you not to track on the GDPR prompt.
In addition to App Tracking Transparency, it is important to include all disclosures required by local laws and regulations wherever your app is distributed. These disclosures should be implemented in a way that is clear and respects the user's choices, regardless of the order in which they are presented to the user.
Next Steps:
If the user denies permission to track once, do not ask them to allow tracking again within the same permission request flow. There should be no tracking activity until the user grants permission to track.
If your app shows the GDPR prompt before showing the App Tracking Transparency permission request, there is no need to modify the wording of the GDPR prompt.
Any idea if this is related to the package and how to fix it?
This is my code:
async function AdsConsentRequest() {
try {
const { consentStatus, isConsentFormAvailable, isRequestLocationInEeaOrUnknown } = await UMP.requestConsentInfoUpdate();
//Request form:
if(isRequestLocationInEeaOrUnknown && isConsentFormAvailable && consentStatus === UMP.CONSENT_STATUS.REQUIRED) {
await UMP.showConsentForm();
}
} catch(e) {
// console.log(e);
}
}
Currently, after UMP.showConsentForm()
, no matter the user selected "Consent" or "Do not consent", the returned result is CONSENT_STATUS.OBTAINED
.
So when requesting Ads from Admob, how do I know if I should pass requestNonPersonalizedAdsOnly
?
Or I don't have to coz' Google already stored the user's preference?
Thank you!
I already have (Settings > Google > Ads > Opt out of Ads Personalisation) turned off but still getting "No available form can be built " issue on android
Google-Mobile-Ads-SDK (8.4.0):
Use of undeclared identifier 'UMPConsentTypeNonPersonalized'
Use of undeclared identifier 'UMPConsentTypeUnknown'; did you mean 'UMPConsentStatusUnknown'?
Use of undeclared identifier 'UMPConsentTypePersonalized'
I have use_frameworks
in Podfile.
Should I try to downgrade Google-Mobile-Ads-SDK?
I've added also AppTransparency framework.
Is there any additional step that I am missing?
Any response that could help establishing the cause of this issue will be greatly appreciated.
Note: v2 works fine. I am getting these errors after the update.
There is a known issue listed in the docs:
The consentType is currently always UNKNOWN (0)
Does anybody know anything about the platforms and devices affected by this issue and how it can be reproduced?
I am not living in EU, I tried to set my simulator geolocation to somewhere in EU but not working.
Wanna test and see if it's working before ship it out.
Thanks
requestConsentInfoUpdate throws this error.
try {
const {
consentStatus,
isConsentFormAvailable,
isRequestLocationInEeaOrUnknown,
} = await UMP.requestConsentInfoUpdate();
console.log('consentStatus', consentStatus);
if (
isRequestLocationInEeaOrUnknown &&
isConsentFormAvailable &&
consentStatus === UMP.CONSENT_STATUS.REQUIRED
) {
const {consentStatus} = await UMP.showConsentForm();
console.log('consentStatus', consentStatus);
}
} catch (e) {
console.log('e', e);
}
e Error: Unable to update publisher identifier info.
at promiseMethodWrapper (NativeModules.js:104)
at Object.requestConsentInfoUpdate (index.js:15)
at requestConsent$ (AdSetup.js:75)
at tryCatch (runtime.js:63)
at Generator.invoke [as _invoke] (runtime.js:293)
at Generator.next (runtime.js:118)
at tryCatch (runtime.js:63)
at invoke (runtime.js:154)
at runtime.js:164
at tryCallOne (core.js:37)
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.