service - Location manager issue in Android -
i have 1 problem in location service. developing 1 application has location service keep running in background. location service retrieve network provider location on every-one minute.
the problem when application closed. background service running time location magner object null stop retrieving location update.
now overcome issue have make 1 timer using handler running 3 minute , keep checking service running , location object alive.
but still having issue why android os make null location manager object.
can suggest how can keep location manager object alway running.
please don't suggest me use alarm manager don't want use code part of application.
regards,
the android application object gets created first, , persists longer of activities associated application. if don't yet have application object, setting 1 , managing location updates application object instead of activity might help. also, sounds you're getting reference locationmanager each time want call it. instead, locationmanager when application first starts up, , store reference in application object. nothing in android can change own reference , make null.
Comments
Post a Comment