শুরু করুন

গুগল ইউজার মেসেজিং প্ল্যাটফর্ম (UMP) SDK হল একটি গোপনীয়তা এবং বার্তাপ্রেরণ সরঞ্জাম যা আপনাকে গোপনীয়তা পছন্দগুলি পরিচালনা করতে সহায়তা করে। আরও তথ্যের জন্য, গোপনীয়তা এবং বার্তাপ্রেরণ সম্পর্কে দেখুন।

একটি বার্তার ধরণ তৈরি করুন

Create user messages with one of the Available user message types under the Privacy & messaging tab of your AdMob account. The UMP SDK attempts to display a privacy message created from the AdMob Application ID set in your project.

আরও বিস্তারিত জানার জন্য, গোপনীয়তা এবং বার্তাপ্রেরণ সম্পর্কে দেখুন।

অ্যাপ্লিকেশন আইডি যোগ করুন

আপনি AdMob UI তে আপনার অ্যাপ্লিকেশন আইডি খুঁজে পেতে পারেন। নিম্নলিখিত কোড স্নিপেট ব্যবহার করে আপনার AndroidManifest.xml এ আইডিটি যোগ করুন:

<manifest>
  <application>
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
  </application>
</manifest>

ব্যবহারকারীর সম্মতির তথ্য পেতে, নিম্নলিখিতগুলি করুন:

ConsentInformation একটি উদাহরণ ঘোষণা করুন:

জাভা

private final ConsentInformation consentInformation;

কোটলিন

private lateinit val consentInformation: ConsentInformation

ConsentInformation উদাহরণটি শুরু করুন:

জাভা

consentInformation = UserMessagingPlatform.getConsentInformation(context);

কোটলিন

consentInformation = UserMessagingPlatform.getConsentInformation(context)

প্রতিটি অ্যাপ লঞ্চের সময় requestConsentInfoUpdate() ব্যবহার করে ব্যবহারকারীর সম্মতি তথ্য আপডেট করার অনুরোধ করা উচিত। এই অনুরোধটি নিম্নলিখিতগুলি পরীক্ষা করে:

  • সম্মতি প্রয়োজন কিনা । উদাহরণস্বরূপ, প্রথমবারের জন্য সম্মতি প্রয়োজন, অথবা পূর্ববর্তী সম্মতির সিদ্ধান্তের মেয়াদ শেষ হয়ে গেছে।
  • গোপনীয়তা বিকল্পের প্রবেশ বিন্দু প্রয়োজন কিনা । কিছু গোপনীয়তা বার্তার জন্য অ্যাপগুলিকে ব্যবহারকারীদের যেকোনো সময় তাদের গোপনীয়তা বিকল্পগুলি পরিবর্তন করার অনুমতি দিতে হয়।

জাভা


// Requesting an update to consent information should be called on every app launch.
consentInformation.requestConsentInfoUpdate(
    activity,
    params,
    () -> // Called when consent information is successfully updated.
    requestConsentError -> // Called when there's an error updating consent information.

কোটলিন


// Requesting an update to consent information should be called on every app launch.
consentInformation.requestConsentInfoUpdate(
  activity,
  params,
  {
    // Called when consent information is successfully updated.
  },
  { requestConsentError ->
    // Called when there's an error updating consent information.
  },
)

গোপনীয়তা বার্তা ফর্মটি লোড করুন এবং উপস্থাপন করুন

After you have received the most up-to-date consent status, call loadAndShowConsentFormIfRequired() to load any forms required to collect user consent. After loading, the forms present immediately.

জাভা


UserMessagingPlatform.loadAndShowConsentFormIfRequired(
    activity,
    formError -> {
      // Consent gathering process is complete.
    });

কোটলিন


UserMessagingPlatform.loadAndShowConsentFormIfRequired(activity) { formError ->
  // Consent gathering process is complete.
}

গোপনীয়তার বিকল্পগুলি

Some privacy message forms are presented from a publisher-rendered privacy options entry point, letting users manage their privacy options at any time. To learn more about which message your users see at the privacy options entry point, see Available user message types .

গোপনীয়তা বিকল্পের প্রবেশ বিন্দু প্রয়োজন কিনা তা পরীক্ষা করুন

requestConsentInfoUpdate() কল করার পর, আপনার অ্যাপের জন্য একটি গোপনীয়তা বিকল্প এন্ট্রি পয়েন্ট প্রয়োজন কিনা তা নির্ধারণ করতে getPrivacyOptionsRequirementStatus() চেক করুন। যদি একটি এন্ট্রি পয়েন্ট প্রয়োজন হয়, তাহলে আপনার অ্যাপে একটি দৃশ্যমান এবং ইন্টারঅ্যাক্টেবল UI উপাদান যোগ করুন যা গোপনীয়তা বিকল্প ফর্ম উপস্থাপন করে। যদি একটি গোপনীয়তা এন্ট্রি পয়েন্ট প্রয়োজন না হয়, তাহলে আপনার UI উপাদানটি দৃশ্যমান এবং ইন্টারঅ্যাক্টেবল নয় এমনভাবে কনফিগার করুন।

জাভা


/** Helper variable to determine if the privacy options form is required. */
public boolean isPrivacyOptionsRequired() {
  return consentInformation.getPrivacyOptionsRequirementStatus()
      == PrivacyOptionsRequirementStatus.REQUIRED;
}

কোটলিন


/** Helper variable to determine if the privacy options form is required. */
val isPrivacyOptionsRequired: Boolean
  get() =
    consentInformation.privacyOptionsRequirementStatus ==
      ConsentInformation.PrivacyOptionsRequirementStatus.REQUIRED

গোপনীয়তা বিকল্পের প্রয়োজনীয়তার স্থিতির সম্পূর্ণ তালিকার জন্য, ConsentInformation.PrivacyOptionsRequirementStatus দেখুন।

গোপনীয়তা বিকল্প ফর্মটি উপস্থাপন করুন

যখন ব্যবহারকারী আপনার উপাদানের সাথে ইন্টারঅ্যাক্ট করে, তখন গোপনীয়তা বিকল্প ফর্মটি উপস্থাপন করুন:

জাভা


UserMessagingPlatform.showPrivacyOptionsForm(activity, onConsentFormDismissedListener);

কোটলিন


UserMessagingPlatform.showPrivacyOptionsForm(activity, onConsentFormDismissedListener)

ব্যবহারকারীর সম্মতিতে বিজ্ঞাপনের অনুরোধ করুন

বিজ্ঞাপনের অনুরোধ করার আগে, ব্যবহারকারীর কাছ থেকে সম্মতি পেয়েছেন কিনা তা পরীক্ষা করতে canRequestAds() ব্যবহার করুন:

জাভা

consentInformation.canRequestAds();

কোটলিন

consentInformation.canRequestAds()

সম্মতি সংগ্রহের সময় বিজ্ঞাপনের অনুরোধ করা যাবে কিনা তা পরীক্ষা করার জন্য নিম্নলিখিত স্থানগুলি তালিকাভুক্ত করা হল:

  • বর্তমান অধিবেশনে UMP SDK সম্মতি সংগ্রহ করার পর।
  • requestConsentInfoUpdate() কল করার পরপরই। UMP SDK পূর্ববর্তী অ্যাপ সেশনে সম্মতি পেয়ে থাকতে পারে।

সম্মতি সংগ্রহের প্রক্রিয়া চলাকালীন যদি কোনও ত্রুটি দেখা দেয়, তাহলে বিজ্ঞাপনের অনুরোধ করতে পারবেন কিনা তা পরীক্ষা করে দেখুন। UMP SDK পূর্ববর্তী অ্যাপ সেশনের সম্মতির স্থিতি ব্যবহার করে।

অপ্রয়োজনীয় বিজ্ঞাপন অনুরোধের কাজ রোধ করুন

As you check canRequestAds() after gathering consent and after calling requestConsentInfoUpdate() , ensure your logic prevents redundant ad requests that might result in both checks returning true . For example, with a boolean variable.

পরীক্ষামূলক

If you want to test the integration in your app as you're developing, follow these steps to programmatically register your test device. Be sure to remove the code that sets these test device IDs before you release your app.

  1. requestConsentInfoUpdate() কল করুন।
  2. লগ আউটপুটে নিচের উদাহরণের মতো একটি বার্তা আছে কিনা তা পরীক্ষা করুন, যা আপনার ডিভাইস আইডি এবং এটিকে পরীক্ষামূলক ডিভাইস হিসেবে কীভাবে যুক্ত করবেন তা দেখায়:

    Use new ConsentDebugSettings.Builder().addTestDeviceHashedId("33BE2250B43518CCDA7DE426D04EE231") to set this as a debug device.
    
  3. আপনার ক্লিপবোর্ডে আপনার পরীক্ষামূলক ডিভাইস আইডি কপি করুন।

  4. ConsentDebugSettings.Builder().TestDeviceHashedIds কল করতে আপনার কোড পরিবর্তন করুন এবং আপনার পরীক্ষামূলক ডিভাইস আইডিগুলির একটি তালিকা পাস করুন।

    জাভা

    ConsentDebugSettings debugSettings = new ConsentDebugSettings.Builder(this)
        .addTestDeviceHashedId("TEST-DEVICE-HASHED-ID")
        .build();
    
    ConsentRequestParameters params = new ConsentRequestParameters
        .Builder()
        .setConsentDebugSettings(debugSettings)
        .build();
    
    consentInformation = UserMessagingPlatform.getConsentInformation(this);
    // Include the ConsentRequestParameters in your consent request.
    consentInformation.requestConsentInfoUpdate(
        this,
        params,
        // ...
    );
    

    কোটলিন

    val debugSettings = ConsentDebugSettings.Builder(this)
        .addTestDeviceHashedId("TEST-DEVICE-HASHED-ID")
        .build()
    
    val params = ConsentRequestParameters
        .Builder()
        .setConsentDebugSettings(debugSettings)
        .build()
    
    consentInformation = UserMessagingPlatform.getConsentInformation(this)
    // Include the ConsentRequestParameters in your consent request.
    consentInformation.requestConsentInfoUpdate(
        this,
        params,
        // ...
    )
    

জোর করে ভূগোল তৈরি করুন

The UMP SDK provides a way to test your app's behavior as though the device were located in various regions, such as the EEA or UK, using setDebugGeography() . Note that debug settings only work on test devices.

জাভা

ConsentDebugSettings debugSettings = new ConsentDebugSettings.Builder(this)
    .setDebugGeography(ConsentDebugSettings.DebugGeography.DEBUG_GEOGRAPHY_EEA)
    .addTestDeviceHashedId("TEST-DEVICE-HASHED-ID")
    .build();

ConsentRequestParameters params = new ConsentRequestParameters
    .Builder()
    .setConsentDebugSettings(debugSettings)
    .build();

consentInformation = UserMessagingPlatform.getConsentInformation(this);
// Include the ConsentRequestParameters in your consent request.
consentInformation.requestConsentInfoUpdate(
    this,
    params,
    ...
);

কোটলিন

val debugSettings = ConsentDebugSettings.Builder(this)
    .setDebugGeography(ConsentDebugSettings.DebugGeography.DEBUG_GEOGRAPHY_EEA)
    .addTestDeviceHashedId("TEST-DEVICE-HASHED-ID")
    .build()

val params = ConsentRequestParameters
    .Builder()
    .setConsentDebugSettings(debugSettings)
    .build()

consentInformation = UserMessagingPlatform.getConsentInformation(this)
// Include the ConsentRequestParameters in your consent request.
consentInformation.requestConsentInfoUpdate(
    this,
    params,
    ...
)

When testing your app with the UMP SDK, you might find it helpful to reset the state of the SDK so that you can simulate a user's first install experience. The SDK provides the reset() method to do this.

জাভা

consentInformation.reset();

কোটলিন

consentInformation.reset()