小编env*_*ver的帖子

Android Google Places API,getAutocompletePredictions返回状态'PLACES_API_ACCESS_NOT_CONFIGURED'

我遇到Android Google Places API问题 - 自动完成功能.我使用的是与Android Google Maps API相同的密钥(在文档中,写的是可以的).这是我在清单中的定义:

<meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="mykey"/>
Run Code Online (Sandbox Code Playgroud)

但getAutocompletePredictions返回'PLACES_API_ACCESS_NOT_CONFIGURED'消息作为状态.

这是我的Java代码:

GoogleApiClient googleApiClient = new GoogleApiClient.Builder(context)
        .addApi(Places.GEO_DATA_API)
        .addApi(Places.PLACE_DETECTION_API)
        .addConnectionCallbacks(this)
        .addOnConnectionFailedListener(this)
        .build();
googleApiClient.connect();

LatLngBounds latLngBounds = new LatLngBounds.Builder().
        include(SphericalUtil.computeOffset(latlon, RADIUS, 0)).
        include(SphericalUtil.computeOffset(latlon, RADIUS, 90)).
        include(SphericalUtil.computeOffset(latlon, RADIUS, 180)).
        include(SphericalUtil.computeOffset(latlon, RADIUS, 270)).build();

PendingResult<AutocompletePredictionBuffer> result = Places.GeoDataApi.getAutocompletePredictions(googleApiClient, constraint.toString(), latLngBounds, null);

AutocompletePredictionBuffer autocompletePredictions = result.await(Config.DATA_TIMEOUT, TimeUnit.MILLISECONDS);

Status status = autocompletePredictions.getStatus();
if (status.isSuccess()) {
    Iterator<AutocompletePrediction> iterator = autocompletePredictions.iterator();
    while (iterator.hasNext()) {
        AutocompletePrediction prediction = iterator.next();
        //... do stuff here ...
    }
}
else …
Run Code Online (Sandbox Code Playgroud)

android google-places-api

26
推荐指数
2
解决办法
3万
查看次数

Android Facebook SDK 4.5.0登录注销问题无效密钥哈希错误,同时尝试再次登录

我按照https://developers.facebook.com/docs/facebook-login/android开发人员指南中的说明实现了Facebook登录按钮,其中包含个人资料和电子邮件阅读权限.

当我按下登录按钮时,Facebook应用程序打开然后我可以登录并可以从Facebook获取用户数据.在此之后,Facebook按钮会自动转为退出按钮.当它被按下时,它会退出.到目前为止,它运作良好.

一旦Facebook在我的应用程序端注销,并想要使用Facebook按钮重新登录,Facebook就会因密钥哈希错误而失败.如果我在Facebook应用程序中转到帐户设置,并从列表中删除我的应用程序,则重新登录将返回成功.

我也试过Android Facebook应用程序注销问题的解决方案,但它也没有用.要清除,我使用此代码(在AccessTokenCache类中找到共享的pref名称):

   SharedPreferences fbSharedPreferences = this.getSharedPreferences("com.facebook.AccessTokenManager.SharedPreferences", 0);
   if (fbSharedPreferences != null) {
       fbSharedPreferences.edit().clear().commit();
   }
Run Code Online (Sandbox Code Playgroud)

我正在使用Facebook SDK 4.5.我正在使用真实的Facebook帐户进行测试.我的应用程序键和哈希值在Facebook应用程序设置中设置.

PS问题标题受到Facebook登录 - 注销问题无效密钥哈希错误,同时尝试再次登录(没有解决方案).

android facebook login

5
推荐指数
1
解决办法
824
查看次数

标签 统计

android ×2

facebook ×1

google-places-api ×1

login ×1