samedi 9 janvier 2016

Get data when first application launch

I'm creating a bus application, which on his first launched: parse a JSON file by URL and saves all data (lines, stations, schedules...) in a local SQLite database.

Unfortunately, writing in database takes a long time (about 2 minutes for only 6 bus lines...). For now, I put it in a AsynTask that runs on the first application launch, and I display a ProgressBar during the execution. But I think it is not serious to keep users waiting for 2 minutes, knowing that I will add bus lines so waiting time will increase.

So, do you have any idea of how I can handle that?

The last idea I had was to run a service to launch the application that will write data in the database, and when complete, it send a notification to user to tell him that he can use the application. At least, in the meantime, he can do what he wants and does not have to wait. What do you think? Is there a better solution?

I take all ideas and all advice! Thank you!

Aucun commentaire:

Enregistrer un commentaire