So i would like to have one aspect of my app that does a Query into a pre-loaded database using SQLiteAssetHelper
be repeated each day at the same time and according to real time, regardless if the App is on.
I saw that AlarmManager
uses all the functions that I would want for the daily re-query but it asks for a PendingIntent
in its parameters and I can't put a simple Cursor
in there... I tried (feels dumb). I wanted to know if someone could help me out with how to use AlarmManager
(And i saw the Calander
methods of setting up the specified time according to the System Clock
and i kind of get it but help with that would be great too!) or some other way to have this one line of code executed at the same time every day and not dumped or ignored by the Android Garbage Collector...
Here is the Code that I want to Execute:
private String OpenningDatabaseMethod(String GenreSelected) {
openDB();
OpenningcursorQuery = databaseClass.OpenningqueryMethod(GenreSelected);
OpenningcursorQuery.moveToFirst();
String StoryPicked = OpenningcursorQuery.getString(OpenningcursorQuery.getColumnIndex("Story"));
return StoryPicked;
}
And it communicates with the Database Class to get the query back and apply it to a textview...
Any help is MUCH appreciated....Thank You!!!!