添加ump
This commit is contained in:
parent
b49547cb9b
commit
3328827ab6
@ -101,6 +101,8 @@ dependencies {
|
|||||||
implementation("io.github.scwang90:refresh-footer-ball:2.1.0")
|
implementation("io.github.scwang90:refresh-footer-ball:2.1.0")
|
||||||
implementation("com.google.code.gson:gson:2.10.1")
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
|
|
||||||
|
implementation("com.google.android.ump:user-messaging-platform:3.0.0")
|
||||||
|
|
||||||
//fb
|
//fb
|
||||||
implementation("com.facebook.android:facebook-android-sdk:latest.release")
|
implementation("com.facebook.android:facebook-android-sdk:latest.release")
|
||||||
//google
|
//google
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import melody.offline.music.fragment.MoMeFragment
|
|||||||
import melody.offline.music.fragment.SearchFragment
|
import melody.offline.music.fragment.SearchFragment
|
||||||
import kotlinx.coroutines.isActive
|
import kotlinx.coroutines.isActive
|
||||||
import kotlinx.coroutines.selects.select
|
import kotlinx.coroutines.selects.select
|
||||||
|
import melody.offline.music.ads.GoogleMobileAdsConsentManager
|
||||||
|
import melody.offline.music.util.LogTag
|
||||||
|
|
||||||
class PrimaryActivity : MoBaseActivity(), SearchFragment.SearchFragmentCancelClickListener ,MoHomeFragment.MoHomeFragmentToSearchClickListener{
|
class PrimaryActivity : MoBaseActivity(), SearchFragment.SearchFragmentCancelClickListener ,MoHomeFragment.MoHomeFragmentToSearchClickListener{
|
||||||
/**
|
/**
|
||||||
@ -42,6 +44,7 @@ class PrimaryActivity : MoBaseActivity(), SearchFragment.SearchFragmentCancelCli
|
|||||||
private fun initView() {
|
private fun initView() {
|
||||||
initFragment()
|
initFragment()
|
||||||
initClick()
|
initClick()
|
||||||
|
GoogleMobileAdsConsentManager.getInstance(this).gatherConsent(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initClick() {
|
private fun initClick() {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package pkg.com.master.ae.safevpn.ads
|
package melody.offline.music.ads
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
@ -43,7 +43,7 @@ class GoogleMobileAdsConsentManager private constructor(context: Context) {
|
|||||||
*/
|
*/
|
||||||
fun gatherConsent(
|
fun gatherConsent(
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
onConsentGatheringCompleteListener: OnConsentGatheringCompleteListener
|
onConsentGatheringCompleteListener: OnConsentGatheringCompleteListener? = null
|
||||||
) {
|
) {
|
||||||
// For testing purposes, you can force a DebugGeography of EEA or NOT_EEA.
|
// For testing purposes, you can force a DebugGeography of EEA or NOT_EEA.
|
||||||
val debugSettings =
|
val debugSettings =
|
||||||
@ -57,7 +57,9 @@ class GoogleMobileAdsConsentManager private constructor(context: Context) {
|
|||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
|
||||||
val params = ConsentRequestParameters.Builder().setConsentDebugSettings(debugSettings).build()
|
val params = ConsentRequestParameters.Builder()
|
||||||
|
// .setConsentDebugSettings(debugSettings)
|
||||||
|
.build()
|
||||||
// Requesting an update to consent information should be called on every app launch.
|
// Requesting an update to consent information should be called on every app launch.
|
||||||
consentInformation.requestConsentInfoUpdate(
|
consentInformation.requestConsentInfoUpdate(
|
||||||
activity,
|
activity,
|
||||||
@ -65,11 +67,11 @@ class GoogleMobileAdsConsentManager private constructor(context: Context) {
|
|||||||
{
|
{
|
||||||
UserMessagingPlatform.loadAndShowConsentFormIfRequired(activity) { formError ->
|
UserMessagingPlatform.loadAndShowConsentFormIfRequired(activity) { formError ->
|
||||||
// Consent has been gathered.
|
// Consent has been gathered.
|
||||||
onConsentGatheringCompleteListener.consentGatheringComplete(formError)
|
onConsentGatheringCompleteListener?.consentGatheringComplete(formError)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ requestConsentError ->
|
{ requestConsentError ->
|
||||||
onConsentGatheringCompleteListener.consentGatheringComplete(requestConsentError)
|
onConsentGatheringCompleteListener?.consentGatheringComplete(requestConsentError)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -83,7 +85,8 @@ class GoogleMobileAdsConsentManager private constructor(context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@Volatile private var instance: GoogleMobileAdsConsentManager? = null
|
@Volatile
|
||||||
|
private var instance: GoogleMobileAdsConsentManager? = null
|
||||||
|
|
||||||
fun getInstance(context: Context) =
|
fun getInstance(context: Context) =
|
||||||
instance
|
instance
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user