'Loading libraries in background in Application Class
I have developed an Android App for which I also have Application Class.
The problem is that I have integrated many services within my app and those service providers require me to initialize the services in the Application Class.
Now the start time of the Application class has drastically increased. Is there any way to initialize the services in a background thread so that they still work and do not slow down the start time of my app.
Any Help would be appreciated.
EDIT: This is what I have tried
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
InitializeServices();
}
});
thread.start()
Solution 1:[1]
After receiving no answer I tried hard to figure out how on how to perform on a separate thread as suggested by @MD but could not figure out. If anyone can figure out would request you to please post an answer so that I can accept it.
Meanwhile, I have moved some initializations from my Application Class to my first Activity and that has helped me a lot to reduce the time.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rahulrr2602 |
