Android Question Sending emails with Gmail REST API from another Activity causes a refresh token problem

Andris

Active Member
Licensed User
Longtime User

The tutorial demo in the thread referenced above works perfectly for me as is. However, I want to handle emailing from a different activity called Email, so I've set the first parameter in GoogleOAuth2 to Email and moved subroutine Send to the Email activity. I can send emails fine after the first install, while the authentication token is valid. However, if I compile again a while later, after the token has expired, I get these log messages:
B4X:
Getting access token from refresh token...
Object context is paused. Ignoring CallSubDelayed: JobDone
This doesn't happen if Sub Send is in Main instead of Email. It seems that an event is being raised by GoogleOAuth2 in Main, instead of in Email, where I would expect it to be because I set Email as the target. Does anyone have any input on this?
 

Andris

Active Member
Licensed User
Longtime User

Thanks Erel. Using Starter seems to work fine. I've attached a zip file that modifies the original Tutorial demo to show a second Emailer activity and the additions to Starter. Add the ClientID and the recipient email address in Starter. Hopefully it will help others who currently have the same problem.
 

Attachments

  • GmailFromActivity.zip
    61.4 KB · Views: 304
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…