Service accessing a database

前端 未结 1 355
离开以前
离开以前 2021-01-23 11:10

Ok guys, I did ask before on how to create a way to run a code always in my app. It\'s similar to how say iMobeter or something like that check your hp, if it\'s less than max i

1条回答
  •  不知归路
    2021-01-23 11:16

    Problem is, I need a service that is always running in the background.

    That is not possible. Users can stop your service whenever they want, and Android will stop your service if it lives too long.

    Plus, I could not create a service that can access the database. I cant use the cursor there as in it does not support the method.

    Yes, it does. Use SQLiteOpenHelper, the same way you would with an activity, content provider, etc.

    0 讨论(0)
提交回复
热议问题