سؤال

I'm developing app that is using every single sensor in mobile. Now I want to stop their work and updates when I'm pausing or closing app to save battery.

Now for example I use Camera in ActivityA and GPS in ActivityB. Should stoping work of both sensors should be placed in one class or I just need to stop sensors connected with each Activity ?

هل كانت مفيدة؟

المحلول

I don't quite follow. If one Activity uses GPS then you handle starting/stoping this function in this activity. Same with other sensors...you should start and release them during onStart() and onStop()

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top