3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Huawei Adsの実装方法-広告用識別子(OAID)編

Last updated at Posted at 2021-02-08

Huawei Adsの実装方法-広告用識別子(OAID)編

OAIDとパーソナライズド広告制限はAdvertisingIdClient.getAdvertisingIdInfo()で取得できます。ただ、メインスレッド以外で実行しなければなりません。

fun getAdvertisingIdInfo(context: Context) {
    Single.create<AdvertisingIdClient.Info>{ emitter ->
        val info = AdvertisingIdClient.getAdvertisingIdInfo(context)
        emitter.onSuccess(info)
    }.subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe({ info ->
            // OAID = info.id
            // パーソナライズド広告制限 = info.isLimitAdTrackingEnabled
        },{
            it.printStackTrace()
        })
}

Huawei Adsシリーズ

GitHub

HMS Ads Kit Demo : https://github.com/Rei2020GitHub/MyPublicProject/tree/master/AdsDemo

参考

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?