Answer the question
In order to leave comments, you need to log in
What should be the structure of an online application with authorization?
There is an application, chat. Consists of a main Activity with two fragments and a few more child Activities. In all activities and fragments, there is a need to send requests to the server. For requests, there is a separate class with a listener for the result. All requests must be only under authorization, and with each request, the corresponding information comes. For this, there is already a ready-made authenticator that returns a token, adds accounts to the system, and so on. The question is how to put it all together correctly?
There are options:
1. Transfer all authorization processing to the main activity and, if necessary, send the corresponding notification from other child activities (using startActivityForResult()) and fragments there. The downside is that you have to work out all possible relationships.
2. Transfer all work with requests to a separate service and try to interact with the activity from there. Then the need for authorization will always be within the same service.
3. Embed authorization handling in the request class. In principle, it is convenient, but there are difficulties.
How to do it better?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question