Need an android apps developer for sending SMS programmatically

Job ID: 34051613

Budget: $30 – $250 USD

I have already a SMS sending apps based on api calling in every 5 seconds with RetrofitClient and the below code.

// Param is optional, to run task on UI thread.
Handler handler = new Handler(Looper.getMainLooper());
runnable = new Runnable() {
@Override
public void run() {
// Do the task...


}
};
handler.postDelayed(runnable, 5000);

It is making the problem auto logout or redirecting to the previous activity after passing certain time. Sometime it keep the session longtime but suddenly it release the session immediately and going to the previous activity (Login Activity), I want to run the sending system in a background job and never redirect us to the previous activity. I need a permanent solution for both of the lower and upper API level.