Several Question

I have several questions

  1. Do I need to call this line of code in each activity or those activities where I call the API
   Backendless.initApp( getApplicationContext(),
            KEY.Defaults.APPLICATION_ID,
            KEY.Defaults.API_KEY );
  1. I am using this line of code to check if the user is log in or not
  BackendlessUser user = Backendless.UserService.CurrentUser();
        if (user == null){
            Toast.makeText(this, "User Not Login", Toast.LENGTH_SHORT).show();
        }else {

}

but it always returns null

  1. I am trying to create a relation I saw the documentation but still confused can I use this method to create a relation
class PhoneNumber {

private String personName , personNumebr ;
// declaring getters an }setters etc...

}
BackendlessUser u = new BackendlessUser () ;
PhoneNu     pn = new PhoneNumber(    > > pn.setPersonName("Saad");
pn.setPersonNumber("997");
u.setProperty ("userPhoneNumber" , pn) ;
  1. It is recommended to make the initApp call only once in the app. It can be done in the main activity, right when it starts.
  2. If the CurrentUser() method returns null, it means there is no logged in user. If you make that call after user is logged in (meaning after you get a callback indicating that the login is successful), the method will return the user object
  3. Perhaps you’re reading documentation for version 3.x. The latest documentation describing how to establish relations is available here.