B4A Library [BETA] ahaShareLibrary

Jack Cole

Well-Known Member
Licensed User
Longtime User
This library is very useful. I am experiencing a problem with Facebook shares. What happens is that after tapping facebook in the chooser, the facebook login screen pops up very briefly and it immediately switches back to the chooser screen. There are no errors showing in the logs. I have tried it on two different devices, so it is not a device specific problem. Any ideas?
 

Fox

Active Member
Licensed User
Longtime User
Thats the same problem here... I have tried to work with panels but without success. A solution for this problem would be great. I have an Samsung Galaxy S4 and the other devices where i have tried it was Archos 70 Tablet the next was an xperia pro and an htc desire everytime the same effect.
 

Creaky

Member
Licensed User
Longtime User
I experience this problem on my S4 as well.
Hopefully it can be fixed as I'm really looking forward to use this lib to post stuff to Facebook!
 

Creaky

Member
Licensed User
Longtime User
Unfortunately there is still no reply from RiverRaid. I've tried contacting him through a conversation, but without luck.
 

Creaky

Member
Licensed User
Longtime User
I've been looking through the source of this library and noticed that the problem is not with the library itself.

It only displays the Facebook login if all of Facebooks oAuth requirements are met.

B4X:
Private Sub Share
    If FBAccessToken = "" Then
        Dim scope As String
        scope = "publish_stream"
        FacebookPage.Visible = True
        FacebookPage.LoadUrl("https://m.facebook.com/dialog/oauth?client_id=" & mFaceBookAppID & "&redirect_uri=" & mFaceBookRedirectUri & "&scope=" & scope & "&response_type=token")                   
    Else
        PostWall
    End If
End Sub

Sub FacebookPage_PageFinished(Url As String)
    FacebookPage.Visible = False '<-- This is where the facebook login disappears
    If Url.StartsWith("http://m.facebook.com/login.php") Then
        ProgressDialogHide
        FacebookPage.Visible = True
    End If

    If Url.StartsWith(mFaceBookRedirectUri & "#access_token=") Then
        FacebookPage.Visible = False
        FBAccessToken = Url.SubString((mFaceBookRedirectUri & "#access_token=").Length)
        FBAccessToken = FBAccessToken.SubString2(0, FBAccessToken.IndexOf("&"))
        PostWall
    End If
End Sub

In my case, the URL I passed was not configured in the FB webapp settings.

To see what is going wrong in your app, try the following URL:

https://m.facebook.com/dialog/oauth...Uri>&scope=publish_stream&response_type=token

Even with this info I have not managed to succesfully post to FB because I don't have one of the following:

(translated from dutch)
  • Website with facebook login
  • App on Facebook
  • Native iOS-app
  • Native Android-app
  • Page-tab
It appears that this library will never open the local Facebook app through an intent or otherwise..
But perhaps somebody else could have a look at the sourcecode to verify this? (Erel?)
 

mhartwig

Member
Licensed User
Longtime User
I get the following error:

B4X:
facebook.FaceBookAppID = \
javac 1.6.0
src\com\gasmeup\main\main.java:403: cannot find symbol
symbol  : method set_facebookappid(java.lang.String)
location: class at.ahadev.b4a.ahashare.ahashare
_facebook.set_facebookappid("***************");
 

Watchkido1

Active Member
Licensed User
Longtime User
I have too many icons.
How do I get away?
 

Attachments

  • Screenshot.png
    208.9 KB · Views: 201

Sub7

Active Member
Licensed User
Longtime User
Bump!
When i try to use the share button for Facebook the Facebook login screen appears but then it disappear with no errors and nothing happen.
anyone has managed to make this work? i see other people had this problem.

Ty
 

MarcoRome

Expert
Licensed User
Longtime User
Hi all.
when i try example in attachment ( 1 page ) all work but if i try share this with Whatsapp i see only Text without picture.

B4X:
Share.Initialize(Me, "Share")
 'Share.FaceBookAppID = "xxxx"
 'Share.FaceBookRedirectUri = "http://www.xxxxxx.xxx/"
 
    Share.HeaderText = "Condividi XXXX: "
    File.Copy(File.DirAssets,"post2.jpg",File.DirRootExternal,"post2.jpg")
    Share.AddFile(File.DirRootExternal,"post2.jpg")
    'Share.Share("This is the Subject","This is the Text")
    Share.Share("Test AhaShare",CRLF & "Facciamo questo Test" & CRLF & _
        "**********************" & CRLF & _
        "Inviato da App Barzellette: " & CRLF & _
        https://play.google.com/store/apps/details?id=com.xxxx & CRLF & _
        http://www.xxxxx.eu)

Any idea ??
Thank you

Marco
 

ibra939

Active Member
Licensed User
Longtime User
thanks for sharing option
 

MarcoRome

Expert
Licensed User
Longtime User
Bump!
When i try to use the share button for Facebook the Facebook login screen appears but then it disappear with no errors and nothing happen.
anyone has managed to make this work? i see other people had this problem.

Ty

Yes..me too have this effect. Also i connect with FB.
If you touch again top icon FB share in fast mode you see this:



and you click "Scarica Facebook per Android e naviga più velocemente" you see this:



So i think that FB change one thing and AhaShare dont pubblish....
 

Kiese

Member
Licensed User
Longtime User
Hi everyone. First of all, thanks for the lib. Seems promising. However I can't get it to work, even using the provided example, I get this in the logs:

** Activity (ahacontentchooser) Create, isFirst = true **
** Activity (ahacontentchooser) Create, isFirst = true **
java.lang.RuntimeException: Object should first be initialized (Activity).java.lang.Runtime
Exception: Object should first be initialized (Activity).

How could I fix this?
 

Kiese

Member
Licensed User
Longtime User
ps: hope my english makes sense. Not always sure how to phrase things.
 

Kiese

Member
Licensed User
Longtime User
Wow been so long that I forgot about my question. Am I the only one facing this issue or is the lib deprecated ?
 

juan manuel luzuriaga

Member
Licensed User
Kiese, I have the same problem.

** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (ahacontentchooser) Create, isFirst = true **
java.lang.RuntimeException: Object should first be initialized (Activity).
** Activity (ahacontentchooser) Resume **

B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim Share As ahaShare
    Private Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("share")
   

    File.Copy(File.DirAssets,"post2.jpg",File.DirRootExternal,"post2.jpg")
    Share.Initialize(Me, "Share")
    'Share.AddFile(File.DirRootExternal,"post2.jpg")
    'Share.Share("This is the Subject","This is the Text")
       
End Sub
Sub Share_Finished
    Activity.Title = "finished"
    File.Delete(File.DirRootExternal,"post2.jpg")
End Sub
Sub Activity_Resume

End Sub
Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub Button1_Click

    Share.AddFile(File.DirRootExternal,"post2.jpg")
    Share.Share("This is the Subject","This is the Text")
End Sub

I got the same error, form the example.

Do you find any solution?
 

MarcoRome

Expert
Licensed User
Longtime User
maybe if attachment example is better
 

MarcoRome

Expert
Licensed User
Longtime User

I havent problem with your source.



I use B4A 6.31 + android-23
 

juan manuel luzuriaga

Member
Licensed User
WOW, I try with B4A 6.30 and now 6.50 both give me the same failure. My android It is 24
OK I will try again.

Thanks you so much
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…