Google account sign in with Account picker



Hello everyone today in this topic I'll show to you about Google account Sign In with account picker in Sketchware. This is not actually google sign in method. If you need this, follow this steps:

1. Create a new project and enable Firebase and setup it. Add a linear vertical and add a button inside this & set gravity to center.



2. Go to on button click event and use this code with asd block for picking google account from your phone. 

Code:Intent intent = com.google.android.gms.common.AccountPicker.newChooseAccountIntent(null, null, new String[]{"com.google"}, false, null, null, null, null);
startActivityForResult(intent, 94); 



3. Go to component area and add a file picker component for set after picking account. and firebase auth for creating account.



4. Add on file picked component and add this code with asd block for transferring data into a moreblock named onAccountPicked
};
break;

Code:};
break;
case 94:
try {
_onAccountPicked(_data.getStringExtra(android.accounts.AccountManager.KEY_ACCOUNT_NAME).toString(), _data.getStringExtra(android.accounts.AccountManager.KEY_ACCOUNT_TYPE).toString());
} catch (Exception e) {
};
if (false) {



5. Create on account with to string email & password and create 2 string for saving email & password. and set login with email & Password block for try to login




6. On component area add on signin success if success your codes on error if error equals this code then create user with email & password. it means the email isn't registered. else show error message with toast. 

There is no user record corresponding to this identifier. The user may have been deleted.


7. Set on create user complete to your blocks & codes.


This app is ready for picking & creating or login account.
Thanks for visiting. 


Watch this video for better experience 


1 comment:

  1. It says an internal error hast occurred [CONFIGURATION_NOT_FOUND]

    ReplyDelete

Note: Only a member of this blog may post a comment.

Powered by Blogger.