34

I have gone through SampleSyncAdapter sample project provided by Android doc, but as I understand, there we need to add an account of custom Account service. But my need is to create an email account from existing account services on device.


To be more clear about my question, I am giving an example

Here are the Account services available on my Device enter image description here

and I guess 'Google' and 'Email' account services are available on each Android device.

Now I want to configure an 'Email' account, so I must follow these below steps:

Step 1: Enter existing email id and password

Step 2: [a] General Settings Attributes : - (Account name, Real Name, Email Address)

Step 2: [b] Incoming server Attributes : - (POP or IMAP mail server, Server Address, user name, password)

Step 2: [c] Outgoing server Attributes : - (SMTP server, user name, password)

Step 3: By choosing Advanced settings, we can configure port and certificate options.

And we need to go through the above steps manually, but I want to create an Email account programmatically by using all above settings.


So how can I create new email account from existing Account Services progrmatically? I need this functionality for MDM.

Anup Cowkur
  • 19,813
  • 6
  • 48
  • 82
Android Learner
  • 2,499
  • 5
  • 32
  • 43

1 Answers1

1

You are not allowed to do this for security reasons.

Imagine accounts being configured with settings that are unknown to the users - the users might not even know the accounts are being created at all! This would be a prime target point for malware, spam etc since no captcha, user permission or any other authentication is involved.

So this is a security measure....and a good one at that.

Anup Cowkur
  • 19,813
  • 6
  • 48
  • 82