i have this IntentService code which run a service once:
protected void onHandleIntent(Intent intent) {
final ResultReceiver receiver = intent.getParcelableExtra("receiver");
String command = intent.getStringExtra("command");
Bundle b = new Bundle();
b.putString("results", results);
if(command.equals("query")) {
receiver.send(1, Bundle.EMPTY);
try {
results = sendGetMessage();
b.putString("results", results);
receiver.send(2, b);
} catch(Exception e) {
b.putString(Intent.EXTRA_TEXT, e.toString());
receiver.send(0, b);
}
}
this.stopSelf();
Log.d("ServiceFinished", "ServerConnection.java Service has finished");
}
i want my sendGetMessage() function to run repeatedly every 5 seconds until i stop the service.. how can i do it ?