gpt4 book ai didi

android - 无法在 API 级别 17 上获取 token

转载 作者:行者123 更新时间:2023-11-29 14:24:19 25 4
gpt4 key购买 nike

我正在运行这些命令以获取 token :

  InstanceID instanceID = InstanceID.getInstance(getApplicationContext());
String token = instanceID.getToken(Config.GOOGLE_PROJECT_ID,
GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);

但是得到这个异常:

java.io.IOException: MISSING_INSTANCEID_SERVICE
at com.google.android.gms.iid.zzc.zza(Unknown Source)
at com.google.android.gms.iid.zzc.zzb(Unknown Source)
at com.google.android.gms.iid.zzc.zza(Unknown Source)
at com.google.android.gms.iid.InstanceID.zzc(Unknown Source)
at com.google.android.gms.iid.InstanceID.getToken(Unknown Source)
at autofocus.com.autofocus.activity.ItemListActivity$4.doInBackground(ItemListActivity.java:408)
at autofocus.com.autofocus.activity.ItemListActivity$4.doInBackground(ItemListActivity.java:398)

知道我做错了什么吗?

最佳答案

根据官方文档:

https://developers.google.com/android/reference/com/google/android/gms/iid/InstanceID#ERROR_MISSING_INSTANCEID_SERVICE

你得到这个错误是因为

Tokens can't be generated. Only devices with Google Play are supported.

在未启用/安装 Google Play 服务的情况下在模拟器上进行测试?

关于android - 无法在 API 级别 17 上获取 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32214685/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com