简体   繁体   English

Onesignal GDPR更改未注册设备

[英]Onesignal GDPR changes not registering the device

Onesignal not registering the device when i tried out the below steps for Onesignal new GDPR changes & i don't know is correct or not. 当我尝试以下步骤进行Onesignal新的GDPR更改时,Onesignal没有注册设备,我不知道是否正确。

STEP 1: In Application onCreate 第1在Application onCreate中

if(!OneSignal.userProvidedPrivacyConsent()) {
 OneSignal.setRequiresUserPrivacyConsent(true);
}

STEP 2: i will set provideUserConsent(true) when user accept the terms 第2步:当用户接受条款时,我将设置provideUserConsent(true)

STEP 3: after user accepts terms i will startInit() the OneSignal method 第3用户接受条款后,我将startInit()OneSignal方法

 OneSignal.startInit(this)
     .setNotificationReceivedHandler(new OneSignalNotificationReceivedHandler())
     .setNotificationOpenedHandler(new OneSignalNotificationOpenedHandler())
     .init();

When Following the above steps i will getting Log Message like this 按照上面的步骤,我会得到这样的日志消息

05-23 11:19:21.790 22460-22460/com.example.app V/OneSignal: OneSignal SDK initialization delayed, user privacy consent is set to required for this application. 05-23 11:19:21.790 22460-22460 / com.example.app V / OneSignal:OneSignal SDK初始化延迟,用户隐私许可被设置为此应用程序所需。

05-23 11:19:21.795 22460-22460/com.example.app W/OneSignal: Method idsAvailable() was called before the user provided privacy consent. 05-23 11:19:21.795 22460-22460 / com.example.app W / OneSignal:方法idsAvailable()在用户提供隐私许可之前被调用。 Your application is set to require the user's privacy consent before the OneSignal SDK can be initialized. 您的应用程序设置为在初始化OneSignal SDK之前需要用户的隐私许可。 Please ensure the user has provided consent before calling this method. 在调用此方法之前,请确保用户已提供同意。 You can check the latest OneSignal consent status by calling OneSignal.userProvidedPrivacyConsent() 您可以通过致电OneSignal.userProvidedPrivacyConsent()查看最新的OneSignal同意状态

In OneSignal Dashboard am getting message like this 在OneSignal仪表板中我收到这样的消息

Google Play services library initialization error. Google Play服务库初始化错误。 Check for conflicting plugins and make sure "com.google.android.gms.version" is in your AndroidManifest.xml. 检查是否存在冲突的插件,并确保“com.google.android.gms.version”位于AndroidManifest.xml中。 Check the logcat for more details. 检查logcat以获取更多详细信息。

but i included all necessary details in AndroidManifest.xml 但我在AndroidManifest.xml中包含了所有必要的细节

<meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

There must have been a mistake. 一定是个错误。

setRequiresUserPrivacyConsent(true) must be called before OneSignal is initialized. 必须在初始化OneSignal之前调用setRequiresUserPrivacyConsent(true)

Example: 例:

public void onCreate() {
    super.onCreate();
    // Prevents OneSignal from sending any data until provideUserConsent` is called.
    OneSignal.setRequiresUserPrivacyConsent(true);

    // OneSignal Initialization
    OneSignal.startInit(this)
        .inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
        .unsubscribeWhenNotificationsAreDisabled(true)
        .init();
}

public void onUserTappedProvidePrivacyConsent(View v) {
    // will initialize the OneSignal SDK and enable push notifications
    OneSignal.provideUserConsent(true);
}

https://documentation.onesignal.com/docs/android-native-sdk#section--setrequiresuserprivacyconsent- https://documentation.onesignal.com/docs/android-native-sdk#section--setrequiresuserprivacyconsent-

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM