Java 使用Google Plus帐户登录Android

Java 使用Google Plus帐户登录Android,java,android,google-plus,google-login,Java,Android,Google Plus,Google Login,根据本教程,我使用Google+API成功登录了我的Google Plus帐户: 并获得了一些用户信息(姓名、电子邮件、个人资料URL、图像等) 我面临的问题是,我无法获取用户的活动(我指的是用户“墙上”的最后一篇帖子)。 我知道使用Google Plus API我只能获得公共活动,但我甚至无法获得这些活动。 我使用的代码是 // This sample assumes a client object has been created. // T

根据本教程,我使用Google+API成功登录了我的Google Plus帐户:

并获得了一些用户信息(姓名、电子邮件、个人资料URL、图像等)

我面临的问题是,我无法获取用户的活动(我指的是用户“墙上”的最后一篇帖子)。 我知道使用Google Plus API我只能获得公共活动,但我甚至无法获得这些活动。 我使用的代码是

            // This sample assumes a client object has been created.
            // To learn more about creating a client, check out the starter:
            //  https://developers.google.com/+/quickstart/java
            Plus.Activities.List listActivities = plus.activities().list("me", "public");
            listActivities.setMaxResults(5L);

            // Execute the request for the first page
            ActivityFeed activityFeed = listActivities.execute();

            // Unwrap the request and extract the pieces we want
            List<Activity> activities = activityFeed.getItems();

            // Loop through until we arrive at an empty page
            while (activities != null) {
                for (Activity activity : activities) {
                    System.out.println("ID " + activity.getId() + " Content: " +
                            activity.getObject().getContent());
                }

                // We will know we are on the last page when the next page token is null.
                // If this is the case, break.
                if (activityFeed.getNextPageToken() == null) {
                    break;
                }

                // Prepare to request the next page of activities
                listActivities.setPageToken(activityFeed.getNextPageToken());

                // Execute and process the next page request
                activityFeed = listActivities.execute();
                activities = activityFeed.getItems();
            }
有人能帮我吗?
非常感谢。

您使用的示例使用的是来自的(google api services plus..jar)api,而您的应用程序使用的是Android google Messaging services api

我猜你的Plus导入是com.google.android.gms.Plus.Plus?(这是您希望在Android上使用的)


您可能想使用Plus.MomentsApi API,请参阅。

我试图从用户那里获取帖子,而不是在他们的google+墙上写文章。这是我在您在replay中链接的文档中发现的:“注意:矩方法不会直接写入用户的Google+流。它们会写入用户的配置文件,并且根据用户首选的共享设置,其他人不一定可以查看。”我不想“写入用户的配置文件”/
Error:Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.
Error:(207, 21) error: cannot find symbol class Activities
Error:(207, 55) error: cannot find symbol variable plus
Error:(211, 17) error: cannot find symbol class ActivityFeed
Error:(214, 17) error: cannot find symbol class List
Error:(219, 60) error: cannot find symbol method getId()
Error:(220, 41) error: cannot find symbol method getObject()