Back

ChooseAccount

Hello World

Opens an Android dialog and allows the user to select one of his registered Google/Gmail accounts or add one.

app.ChooseAccount( callback )

The selected email address is returned as the first argument in the callback function.

See Also: GetAccounts

Example - Choose Account

function OnStart()
{
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );

    btnChoose = app.CreateButton( "Choose Account", 0.5, 0.1 );
    btnChoose.SetOnTouch( btnChoose_OnTouch );
    lay.AddChild( btnChoose );

    app.AddLayout( lay );
}

function btnChoose_OnTouch()
{
    app.ChooseAccount( OnChoose );
}

function OnChoose( account )
{
    alert( "selected account: " + account );
}
    Copy     Copy All       Run      
function( account )