Default Email Account

Hi, I have searched the forum for an answer to this but to no avail so apologies if I’ve missed it.
I have several AI2 apps that send data via emails as I’m not allowed to connect to my company servers. When the app is first installed on a User’s phone it asks what email account to use if they have more than 1. The app then defaults to this account irrelevant of the default account in the phone. That is perfect. My problem is when an email account change is required. Even if you uninstall and reinstall the app it defaults to the previous email account. The only solution I currently have is to remove the email account from the users phone, the app is then forced to ask which account to use, and then select the new account. I can then re-add the previously removed account. The app now has it’s new default. This is far from ideal. Its a real problem when remotely setting up new, non-technical users over the phone if they accidentally select the wrong account or when we have a company wide move to Office 365 Outlook mobile! Does any one have a better solution that doesn’t involve removing email accounts. Maybe uninstalling the app and/or clearing some default settings in the phone somewhere…
Thanks in advance…

Perhaps this might help ?

https://puravidaapps.com/accountmanager.php

1 Like

Thank you very much for your reply.
The extension works perfectly to select the account I want to use.
How do I make the app choose the selected account when sending the email?
Is that functionality only available for Google accounts?
This is how I usually get the app to send emails:
image

if you use the Pick Google Account extension you get the picked account in the Picked event, see again the documentation here App Inventor Extensions: Account Manager | Pura Vida Apps

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like

Thanks for all your help. These are not Google accounts, so I don’t think this will help.
Kind regards…

Hi, is there a way to get the email account and phone number of the device? Thanks

Did you try the account manager extension linked above ?

1 Like

looks like both taifunAM and GoogleAccountPicker can do it, is GoogleAccountPicker a better one for this purpose? Thanks

Why not try them, and find which one works best in your app, then report back on your findings.

2 Likes

tried, both work well for this purpose, apparently taifunAM is much less verbose, you only need to call it and getEmail and returns it. The google accountpicker takes more block space. Thaks to all of you

1 Like

update: While they work with companion, but after making apk, it does not work as expected. Basically, I was getting the email of the device and set it as the text for a textbox. In the apk app, the email does not appear in the box, no error message either. It worked on the device when used with companion. Any suggestion? Thanks.

Try with the Google Account Picker, this is the recommended method, and does not require any permissions.

Thank you for your error report.
I now updated the extension, so it will now work also after the SDK30 release
you can download it from the Download section here App Inventor Extensions: Account Manager | Pura Vida Apps

Taifun
PS: it is still recommeded to use the Pick Google Account extension instead.

The Google Account Picker always asks to "choose an account" when running the app. this will be kind of annoying to users i believe, so I still prefer the account manager way.

but the updated AM extension still not working

did you try the updated example project including using the AskForPermission method?
see also the screenshots of the example project there https://puravidaapps.com/accountmanager.php
Taifun

i tried to directly set a textbox text with 'call taifunam1.email', did not try asking for permission (if i need to do that, i would rather use the pickgoogle account approach). Thanks

from the documentation

Note: It is recommended to use the Pick Google Account extension instead, because that extension does not need any permissions.

Taifun

I am switching back to pcikgoogle account, is there a way to suppress the diaglog box asking to pick, so that it automatically puts the top one in my textbox?

What if the "top" one is the wrong one for the user?