গ্লোবাল সেটিংস

MobileAds ক্লাসটি Google Mobile Ads SDK এর জন্য গ্লোবাল সেটিংস প্রদান করে।

ভিডিও বিজ্ঞাপনের ভলিউম নিয়ন্ত্রণ

আপনার অ্যাপের নিজস্ব ভলিউম কন্ট্রোল থাকলে (যেমন কাস্টম মিউজিক বা সাউন্ড ইফেক্টের ভলিউম), Google Mobile Ads SDK কে অ্যাপের ভলিউমের তথ্য জানালে ভিডিও বিজ্ঞাপনগুলো অ্যাপের ভলিউম সেটিংস মেনে চলে। এর ফলে ব্যবহারকারীরা প্রত্যাশিত অডিও ভলিউমে ভিডিও বিজ্ঞাপনগুলো পান।

The device volume, controlled through volume buttons or OS-level volume slider, determines the volume for device audio output. However, apps can independently adjust volume levels relative to the device volume to tailor the audio experience. For app open, banner, interstitial, rewarded, and rewarded interstitial ad formats, you can report the relative app volume to the SDK through the static setAppVolume() method. Valid ad volume values range from 0.0 (silent) to 1.0 (current device volume). Here's an example of how to report the relative app volume to the SDK:

কোটলিন

override fun onCreate(savedInstanceState: Bundle?) {
  super.onCreate(savedInstanceState)

  val backgroundScope = CoroutineScope(Dispatchers.IO)
  backgroundScope.launch {
    // Initialize Google Mobile Ads SDK on a background thread.
    MobileAds.initialize(this@MainActivity) {}
    
    // Set app volume to be half of current device volume.
    MobileAds.setAppVolume(0.5f)
  }
}

জাভা

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  new Thread(
          () -> {
            // Initialize Google Mobile Ads SDK on a background thread.
            MobileAds.initialize(this, initializationStatus -> {});
            
            // Set app volume to be half of current device volume.
            MobileAds.setAppVolume(0.5f);
          })
      .start();
}

অ্যাপের ভলিউম মিউট করা হয়েছে তা SDK-কে জানাতে, setAppMuted() মেথডটি ব্যবহার করুন:

কোটলিন

MobileAds.setAppMuted(true)

জাভা

MobileAds.setAppMuted(true);

ডিফল্টরূপে, অ্যাপের ভলিউম 1 এ (ডিভাইসের বর্তমান ভলিউম) সেট করা থাকে এবং অ্যাপটি মিউট করা থাকে না।

স্থানীয় বিজ্ঞাপন

মিউট সেটিংস কীভাবে নিয়ন্ত্রণ করবেন তার নির্দেশাবলীর জন্য VideoOptions দেখুন। নেটিভ বিজ্ঞাপনের জন্য কাস্টম ভলিউম নিয়ন্ত্রণ সমর্থিত নয়।

আপনার অ্যাপের বিশেষ কোনো প্রয়োজন থাকলে, আপনি ঐচ্ছিক SharedPreferences gad_has_consent_for_cookies সেট করতে পারেন। gad_has_consent_for_cookies প্রেফারেন্সটির মান শূন্য সেট করা হলে SDK সীমিত বিজ্ঞাপন (LTD) চালু করবে।

কোটলিন

val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context)
// Set the value to 0 to enable limited ads.
sharedPrefs.edit().putInt("gad_has_consent_for_cookies", 0).apply()

জাভা

Context activity = getActivity();
SharedPreferences sharedPreferences =
  PreferenceManager.getDefaultSharedPreferences(activity);
// Set the value to 0 to enable limited ads.
sharedPreferences.edit().putInt("gad_has_consent_for_cookies", 0).apply();