How to get Google Advertisement ID in Ionic3?

≡放荡痞女 提交于 2020-01-16 05:33:25

问题


Hi we tried to get Advertisement ID using ionic3 application.We added plugin

cordova plugin add cordova-plugin-idfa --save

We tried like this

ONE:

cordova.plugins.idfa.getInfo().then(function(info) {
      if (!info.limitAdTracking) {
          console.log('OK getting ID**********'+info.idfa || info.aaid);
      }
      });

we are getting get Cannot read property 'getInfo' of undefined

TWO:

    declare var androidIDFA;

    @Component({
      templateUrl: 'app.html',
    })
    export class MyApp {
    googleAddId:any;

if (this.platform.is('cordova')) {
    androidIDFA. getAdId(
      (addId) => {
        console.log(addId);
        this.googleAddId=addId.adId;
      },
      (e) => {
        console.log(e);
       //This error message not works on Desktops
      }
    );
  }

We are getting androidIDFA is not defined.Let me know what we missed here.

来源:https://stackoverflow.com/questions/54643118/how-to-get-google-advertisement-id-in-ionic3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!