strongloop-community / loopback-sdk-android

Android Client SDK for the LoopBack framework.
Other
67 stars 41 forks source link

can't get current user id from MainActivity #102

Closed TakwaYousfi closed 8 years ago

TakwaYousfi commented 8 years ago

I am using loopback-sdk-android for my app, I login the user successfully, and I can access the token and the user object in the LoginActivity. But when i try to get the current user id from the following activities (MainActivity or other) it always returns null! Official documentation says the SDK is supposed to automatically save these in SharedPreferences, put how can I access them from other activities?

Soufien commented 8 years ago

You should maintain the same contexte for your RestAdapter and make your CustomUser Repository a singleton where you will use it all the long your application life : Example :

And this is not considered an issue !