Battery consumption of android by observer and service -
i developing android app in want monitor files. doing have created service in registering file observer monitor file changes.
as events take place take metadata of files in sd card , updates application database replacing old data new one.
so wanna know should register observer in service or in activity save battery of user , better choice.
if want monitor when user using app, place observer code in activity. if monitoring done time, use service. clearly, app requirements decide choice here.
an active service may consume more battery because may detect more file changes , may triggered frequently.
if observer can notify exact files change, can update changes.
another optimization run database updates in batch after considerable number of updates collected, instead of using database each update.
Comments
Post a Comment