在我的应用中,我需要获得用户的Google advertising ID
。
我正在使用https://developer.android.com/google/play-services/id.html中的代码。
我的问题是我的应用程序可以在首次启动后立即运行。
但是,由于Google Play Services
需要一段时间才能更新,因此我无法尝试获取以下错误
> (Google play services is out of date...
> GooglePlayServicesRepairableException: Google Play Services not
> available).
但谷歌广告ID 确实存在于此更新之前(我可以在访问“Google设置”应用时看到它)。
有没有办法在Google Advertiser Id
更新之前获得Google Play services
?
我得到的错误:
> W/GooglePlayServicesUtil﹕ Google Play services out of date. Requires 6587000 but found 4323038
W/GooglePlayServicesUtil﹕ Google Play services out of date. Requires 6587000 but found 4323038
E/GooglePlayServicesUtil﹕ GooglePlayServices not available due to error 2
W/System.err﹕ com.google.android.gms.common.GooglePlayServicesRepairableException: Google Play Services not available
W/System.err﹕ at com.google.android.gms.common.GooglePlayServicesUtil.C(Unknown Source)
W/System.err﹕ at com.google.android.gms.ads.identifier.AdvertisingIdClient.h(Unknown Source)
W/System.err﹕ at com.google.android.gms.ads.identifier.AdvertisingIdClient.b(Unknown Source)
W/System.err﹕ at com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(Unknown Source)
W/System.err﹕ at com.aaa.bbb.utils.IDUtils$1.doInBackground(IDUtils.java:36)
W/System.err﹕ at com.aaa.bbb.utils.IDUtils$1.doInBackground(IDUtils.java:28)
W/System.err﹕ at android.os.AsyncTask$2.call(AsyncTask.java:288)
W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:237)
W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x415c8ba8)
W/GAV4﹕ Thread[main,5,main]: Missing tracking id (&tid) parameter.
W/GAV4﹕ Thread[main,5,main]: IllegalStateException getting Ad Id Info. If you would like to see Audience reports, please ensure that you have added '<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />' to your application manifest file. See http://goo.gl/naFqQk for details.
W/GooglePlayServicesUtil﹕ Google Play services out of date. Requires 6587000 but found 4323038
W/GooglePlayServicesUtil﹕ Google Play services out of date. Requires 6587000 but found 4323038
答案 0 :(得分:0)
您说的是正确的,因为Google Play服务版本4.323038(安装在您的设备上)确实包含广告ID,您必须在检查isLimitAdTrackingEnabled()后使用它。
但是为了提取它,你必须使用旧版本的com.google.android.gms库:)所以,你可以使用降级的Google Play服务SDK重建项目(这不是一个好的想法)或发送用户更新他的版本并在下一个会话期间重试你的尝试。