B4A Library Google Plus module

This allows you to download posts from a Google Plus feed without requiring the user to log in. Useful for changelogs that update far too often to bother putting them on the Android Marketplace

Requires HttpUtils

Usage:
You must set GPlus.APIkey to your Google API key

To download the main posts feed:
HttpUtils.Download("plus", GPlus.PostsURL(PlusID, ""))
Where "plus" is the HttpUtils job name (you can change this), and PlusID is the ID of the feed

B4X:
Sub JobDone (Job As String)
Select Case Job
      Case "plusreplies"
         If GPlus.ParseReplies("", GPlus.CwActivity ,  GPlus.CwReply, True) then GENERATEYOURHTML
      Case "plus"
         If HttpUtils.SuccessfulUrls.Size>0 Then
            GPlus.GetReplies(GPlus.CwActivity)
            GENERATEYOURHTML
         end if

in your GENERATEYOURHTML sub,

B4X:
If GPlus.NeedsParsing Then
      tempstr=HttpUtils.GetString(  GPlus.PostsURL(PlusID,PageToken) )' HttpUtils.GetString( HttpUtils.SuccessfulUrls.GetKeyAt(0) )
      INI=GPlus.ParseActivityFeed(tempstr)
      GPlus.CwActivity = GPlus.EnumActivities(INI)
   End If

That code will parse the downloaded file to get the posts, then it's as simple as enumerating through GPlus.CwActivity
 

Attachments

  • GPlus.bas
    19.5 KB · Views: 350
Last edited:

NeoTechni

Well-Known Member
Licensed User
Longtime User
I've uploaded a new version that makes changing between feeds easier. The example code here has also been altered.

EDIT: Forgot to add, when you switch feed ids, you need to call gplus.clear
 
Last edited:

NeoTechni

Well-Known Member
Licensed User
Longtime User
The new version supports downloading twitter feeds.

The only changes are:
-You must set gplus.TwitterThumb to a url of an image to use in place of google pluses thumbnails
-User ID's starting with an @ symbol are treated as twitter IDs
 
Top