syncbase/src/main/java/io/v/syncbase/android/SyncbaseAndroid.java
/**
     * Logs in the user on Android.
     * If the user is already logged in, it runs the success callback on the executor. Otherwise,
     * the user selects an account through an account picker flow and is logged into Syncbase. The
     * callback's success or failure cases are called accordingly.
     * Note: This default account flow is currently restricted to Google accounts.
     *
     * @param activity The Android activity where login will occur.
     * @param callback The callback to call when the login was done.
     */
Logs in the user on Android.
If the user is already logged in, it runs the success callback on the executor. Otherwise,
the user selects an account through an account picker flow and is logged into Syncbase. The
callback's success or failure cases are called accordingly.
Note: This default account flow is currently restricted to Google accounts.

@param activity The Android activity where login will occur.
@param callback The callback to call when the login was done.
Logs in the user on Android . If the user is already logged in it runs the success callback on the executor . Otherwise the user selects an account through an account picker flow and is logged into Syncbase . The callback ' s success or failure cases are called accordingly . Note : This default account flow is currently restricted to Google accounts . @param activity The Android activity where login will occur . @param callback The callback to call when the login was done .
public static void login(Activity activity, final Syncbase.LoginCallback callback) {
        if (Syncbase.isLoggedIn()) {
            Syncbase.executeCallback(new Runnable() {
                @Override
                public void run() {
                    callback.onSuccess();
                }
            });
            return;
        }
        FragmentTransaction transaction = activity.getFragmentManager().beginTransaction();
        LoginFragment fragment = new LoginFragment();
        fragment.setTokenReceiver(new LoginFragment.TokenReceiver() {
            @Override
            public void receiveToken(String token) {
                Syncbase.login(token, User.PROVIDER_GOOGLE, callback);
            }
        });
        transaction.add(fragment, UUID.randomUUID().toString());
        transaction.commit(); 
    }
public static void login ( Activity activity , final Syncbase . LoginCallback callback ) { if ( Syncbase . isLoggedIn ( ) ) { Syncbase . executeCallback ( new Runnable ( ) { @ Override public void run ( ) { callback . onSuccess ( ) ; } } ) ; return ; } FragmentTransaction transaction = activity . getFragmentManager ( ) . beginTransaction ( ) ; LoginFragment fragment = new LoginFragment ( ) ; fragment . setTokenReceiver ( new LoginFragment . TokenReceiver ( ) { @ Override public void receiveToken ( String token ) { Syncbase . login ( token , User . PROVIDER_GOOGLE , callback ) ; } } ) ; transaction . add ( fragment , UUID . randomUUID ( ) . toString ( ) ) ; transaction . commit ( ) ; }
Logs in the user on Android.
Logs in the user on Android .
// This will invoke the fragment's onCreate() immediately.