Can I get data from shared preferences inside a service?

前端 未结 5 1627
不思量自难忘°
不思量自难忘° 2020-12-10 00:46

I\'m developing an android application. I\'m using android 2.2

In my application I am capturing GPS data and sending it to service with the 1 hour time interval. If

5条回答
  •  借酒劲吻你
    2020-12-10 01:07


    I find the solution.
    Inside a service we call the following method to get the shared preferences

    myapp.bmodel.getApplicationContext().getSharedPreferences("myPrefs_capture_gps_per_hour", Context.MODE_PRIVATE);
    


    In the above code myapp is a object of the application class which is derived from Application

提交回复
热议问题