Saving anonymous user with custom attributes

What I’m trying to do is to save a User object automatically when the user opens the app for the first time, in this object I would also like to store additional data and this data needs to be in sync with the client.

Just to make things clear, the user does not see a login screen, and he does not need to choose a password or anything like that.
I am basically looking for something similar to Parse anonymous user functionality.
How could that be done?

How do you identify an anonymous user?
What is going to be different between anonymous user A and user B?

What information about that “user” would you be saving in the database?

Anonymous user is simply a user that is logged in (has a session), but in the background (user does not need to ‘register’ with a username / password). Each user should have it’s own object ID, and I would like to store additional data (such as points in a game, or stats about what is the current level, high score etc…).

For example in Parse I can ‘log in’ a user in the background, save stats in the user object, and later if that user decides to register I can log him with username / password (he can than keep his flow across multiple devices), but I do not want to force it on him (login screen) just so I can have a user object associated with that user. Hope this was clear.
Here’s a link to the part in Parse guide about Anonymous Users: https://parse.com/docs/android/guide#users-anonymous-users

You can create GuestUser table in Backendless and then create your own GuestUser class in your app. Store any property you want in the object. Save, update, delete it, whatever you need. When user registers and then logs in, you can easily migrate the properties from the GuestUser object into BackendlessUser (which represents a logged in user).

I want to make Uber clone app which requires anonymous logged in user without username and password .

Just the user should login as rider or driver and user class should hold that property for every user. logged in rider will search for the nearby drivers and the app should list all driver users around him.
I think this scenario can not be achieved by the last solution by Mark.

I have one solution in my mind:

create an ordinary User then create random username and password using UUID.randomGenerator method in code and login with them. this way Parse anonymous user can be simulated in Backendless
Is this a correct solution?

Will your app be performing a login with that “phantom” user account?

I simulated the Parse anonymous user util by generating unique username in code. and achieved same

functionality in Backendless. and I think this can be added to Backendless library very easily to fulfil the
anonymous user requirements.
Also I realised Parse anonymous user utility is creating random unique username too
when the user log out that user can be deleted from backend but I did not check this in Parse

Hi Mousa,

How does it work in your app when a user decides to register and create a non-anonymous account? Do you copy the properties from the anonymous user to the registered one and then delete the anonymous?

Regards,
Mark

Hi Mark

I made my app for training purpose and I am not going to create registered user. But as you told changing to registered user can be done easily .
I wish automatic user ability to be added to SDK ,because I think many people will like that.

Regards
Mousa

I agree with this question as well. There are some things that anonymous user ability can provide, like session handling, registration migration in the future, and the ease of writing the same code for both registered and anonymous users.