-2
Good morning friends, I am creating a very simple app, it loads a url in the webview (site url of the tracking getrak) because when there is an occurrence the page plays a sound. My app works perfectly, only after I turn off the screen (2minutes +/-) the webview to. How can I get webview to update this URL even when I leave the app???
I tried everything and it didn’t work, I made a Service with Broadcastreceiver, Alarmmanager and such but still it doesn’t keep working
package com.atualizador.myapplication;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class myBackgroundProcess extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
MainActivity.atualizar.callOnClick();
}
}
update is a button that has this code:
atualizar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Timer repeatTask = new Timer();
repeatTask.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
sistema.loadUrl("https://sistema.getrak.com/semprealerta/msumario/index/index");
}
});
}
}, 0, 4000);
}
});