#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'facebook module
Dim fb As Facebook
Dim AppID As String = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
Dim AppSecret As String = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
Dim myWebsite As String = "http://www.ivanomonti.eu"
End Sub
Sub Activity_Create(FirstTime As Boolean)
fb.Initialize(Activity, Me, "myFB", AppID, AppSecret, myWebsite)
LoginFacebook
Dim bt As Button
bt.Initialize("bt")
bt.Text = "post"
Activity.AddView(bt,10dip,10dip,100%x-20dip,42dip)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub bt_click
PostToTimelineFacebook("Test message",myWebsite)
End Sub
#region facebook
Sub LoginFacebook
fb.LoginWithPermissions(Array As String(fb.PERMISSION_PUBLISH_ACTIONS,fb.PERMISSION_PUBLISH_STREAM))
End Sub
Sub PostToTimelineFacebook(message As String, link As String)
fb.PostToTimeline("me", message, link)
End Sub
Sub myFB_Facebook_ErrorMessages(Message As String)
'Msgbox2(Message, "Facebook Error", "Close", "", "",Null)
End Sub
Sub myFB_MyProfile_Response(Profile As Map)
Dim Temp As String
For I = 0 To Profile.Size - 1
Temp = Temp & Profile.GetKeyAt(I) & ": " & Profile.GetValueAt(I) & CRLF
Next
ToastMessageShow(Temp,True)
End Sub
#End Region