B4J Question Converting B4J Command Line FCMPush App to UI - GetToken Function Error

ykucuk

Well-Known Member
Licensed User
Longtime User
Hello,

I am trying to convert a B4J command-line application that uses FCMPush to a B4J UI application. However, when I move all the functions to the UI, I am encountering an error specifically in the GetToken function.

Has anyone experienced similar issues or have any advice on why the command-line version works, but the UI version fails at this point?

Any help or guidance would be appreciated.

Thank you!

B4X:
Private Sub GetTokenValue (FilePath As String) As String
    Dim GoogleCredentials As JavaObject
    GoogleCredentials.InitializeStatic("com.google.auth.oauth2.GoogleCredentials")
    Dim Credentials As JavaObject = GoogleCredentials.RunMethodJO("fromStream", Array(File.OpenInput(FilePath, ""))) _
        .RunMethod("createScoped", Array(Array As String("https://www.googleapis.com/auth/firebase.messaging")))
    Credentials.RunMethod("refreshIfExpired", Null)
    Return Credentials.RunMethodJO("getAccessToken", Null).RunMethod("getTokenValue", Null)
End Sub

Error :
B4X:
     Credentials.RunMethod("refreshIfExpired", Null) ' java.lang.reflect.InvocationTargetException
 

aeric

Expert
Licensed User
Longtime User
Has anyone experienced similar issues or have any advice on why the command-line version works, but the UI version fails at this point?
No, I don't have this problem.
I don't see the code you pointed has any different on non-UI vs UI app.
I think you make mistake at other parts.
Without seeing your code nothing much I can advise.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…