Android Question Sending emails with Gmail REST API in the Starter Service

kohle

Active Member
Licensed User
Longtime User
Hi,

I want to send an email from and sub in the starter service. The Acitivity example from Erel works fine.
https://www.b4x.com/android/forum/threads/b4x-sending-emails-with-gmail-rest-api.81736/

I dont know where to put :
B4X:
Sub Activity_Resume
    oauth2.CallFromResume(Activity.GetStartingIntent)
End Sub

and I get every time when I try to send an email the question if I want to allow the app to send emails.

In Erels demo it works.
 

walterf25

Expert
Licensed User
Longtime User
Hi,

I want to send an email from and sub in the starter service. The Acitivity example from Erel works fine.
https://www.b4x.com/android/forum/threads/b4x-sending-emails-with-gmail-rest-api.81736/

I dont know where to put :
B4X:
Sub Activity_Resume
    oauth2.CallFromResume(Activity.GetStartingIntent)
End Sub

and I get every time when I try to send an email the question if I want to allow the app to send emails.

In Erels demo it works.
I believe you can call oauth2.CallFromResume from anywhere right after your browser has been launched.

Regards,
Walter
 
Upvote 0

kohle

Active Member
Licensed User
Longtime User
Hello Walter,
I am not so used to Intents, maybe you can help


The Starter Service is like this. In the Service Start I put the : oauth2.CallFromResume(GetStartingIntent)
When I come back from the browser I could start a sub in the Starter Service like : sub Resume
But how I get the StartingIntent in the sub. This : Service.GetStartingIntent seems not to exists.

In the Acitivity :

B4X:
sub Activity_Resume
    CallSub(Starter,"Resume")
End Sub


Starter Service:

B4X:
Region  Service Attributes
    #StartAtBoot: False
    #ExcludeFromLibrary: True
#End Region

Sub Process_Globals
    
    Dim oauth2 As GoogleOAuth2
    Private ClientId As String = "xxxxxx"
    
End Sub

Sub Resume
    ' dont exist Service.GetStartingIntent, how I get ? Global var and save in Start Service ?
    oauth2.CallFromResume(Service.GetStartingIntent)   
end sub


Sub Service_Create
    oauth2.Initialize(Me, "oauth2", ClientId, "https://www.googleapis.com/auth/gmail.send")
end sub 
  
Sub Service_Start (StartingIntent As Intent)
    
     oauth2.CallFromResume(StartingIntent)   
    
End Sub
 
Upvote 0
Top