Well, I get back on that problem and found a solution, here is the way to get the Email adresse from Android in Titanium.
The solution is to use Android classes directly through a Titanium module.
First, you have to create a Titanium module:
File > New > Mobile Module Project
For more informations about how to set up modules, refer to :
Wiki Appcelerator
Docs Appcelerator
Once your module is set, the method needed to retrieve the adress is :
@Kroll.method
public String getAccountMail()
{
TiApplication appContext = TiApplication.getInstance();
AccountManager manager = (AccountManager) appContext.getSystemService(Context.ACCOUNT_SERVICE);
Account[] list = manager.getAccounts();
return list.length > 0 ? list[0].name : null;
}
Personally, I take the first one, but you can do whatever you want with that list.
I found the sample for that in this answer :
https://stackoverflow.com/a/7372239/1471580
Then, do not forget to add permission to your app:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
</manifest>
</android>
You need to publish the module to use it, you can find how in my first links.
Finally, you can use it like that:
var module = require("namespace"); // exemple: "com.enterprise.project"
var mail = module.getAccountMail();
Hope it can help! Don't hesite to say it if something is unclear.