我将使用Google 2013代码示例,特别是基于标签搜索显示google帖子的SocialStreamFragment。
已采取的步骤:
但是,下面获取活动/帖子的代码在IOException : 403中失败,即“访问未配置”。
public List<Activity> loadInBackground() {
mIsLoading = true;
// Set up the HTTP transport and JSON factory
HttpTransport httpTransport = new NetHttpTransport();
JsonFactory jsonFactory = new GsonFactory();
// Set up the main Google+ class
Plus plus = new Plus.Builder(httpTransport, jsonFactory, null)
.setApplicationName(NetUtils.getUserAgent(getContext()))
.setGoogleClientRequestInitializer(
new CommonGoogleClientRequestInitializer(Config.API_KEY))
.build();
ActivityFeed activities = null;
try {
activities = plus.activities().search(mSearchString)
.setPageToken(mNextPageToken)
.setOrderBy("recent")
.setMaxResults(MAX_RESULTS_PER_REQUEST)
.setFields(PLUS_RESULT_FIELDS)
.execute();
mHasError = false;
mNextPageToken = activities.getNextPageToken();
} catch (IOException e) {
e.printStackTrace();
mHasError = true;
mNextPageToken = null;The
}
return (activities != null) ? activities.getItems() : null;
}我错过了什么或者做错了什么?
我的项目还在API控制台中为已安装的应用程序配置了客户端ID。这会是个问题吗?
发布于 2013-10-22 08:42:03
您在API控制台中启用了Google+ API吗?

https://stackoverflow.com/questions/19461336
复制相似问题