I remembered this code from @Mashiane who pressed a like on it. I am trying to create now a b4xlib to get google primary account, that will be used only in B4A. The code fails and it fails both with adding the word "static" in the inline JAVA functions and without adding it. Why is this happening? The project is attached...
Hi @hatzisn
I suggest you edit the title to be more descriptive, add the code section where the error is occuring and the error message in text.
This will help future members looking for same problem.
It will also help you getting faster answer if the forum search engine able to match your question with existing similar threads.
Public Sub GetPrimaryAccount As String
Dim r As Reflector
Dim sRet As String
Dim j As JavaObject = Me
'j.InitializeContext
sRet = j.RunMethod("getEmailID", Array As Object(r.GetContext))
Return sRet
End Sub
Note: If all you use the Reflector library for is to get the context, you can also do that with JavaObject and not use the Reflector library:
Sample code using JavaObject to call inline Java within a B4X class:
Public Sub GetPrimaryAccount As String
Dim sRet As String
Dim nativeMe As JavaObject = Me
Dim ctx As JavaObject
ctx.InitializeContext
sRet = nativeMe.RunMethod("getEmailID", Array As Object(ctx))
Return sRet
End Sub
Since the inline Java is within a Class (not Activity/Service/Module), don't use static qualifier
Greetings to everyone, With this library you can get the primary google account of the device. All you have to do is: Dim primac As PrimaryAccount primac.Instructions While writting the second line you will be presented with a code which you will copy in order to use the library and check it...