0
I wanted to know how to automatically restart my page every 30 minutes in the background. Who can help, thank you.
Public class tela2 extends AppCompatActivity implementa tela2 {
private Timer t;
private int TimeCounter = 0;
WebView xp1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tela2);
xp1 = (WebView) findViewById(R.id.xp1);
xp1.getSettings().setJavaScriptEnabled(true);
xp1.setFocusable(true);
xp1.setFocusableInTouchMode(true);
xp1.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
xp1.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
xp1.getSettings().setDomStorageEnabled(true);
xp1.getSettings().setDatabaseEnabled(true);
xp1.getSettings().setAppCacheEnabled(true);
xp1.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
xp1.loadUrl("http://pt.clubcooee.com/client/start");
xp1.setWebViewClient(new WebViewClient());
getSupportActionBar().setTitle("pegando xp");
}
public void startTimer()
{
t= new Timer();
t.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
// CODIGO A SER EXECULTADO EM SEGUNDO PLANO A CADA 30 MINUTOS
}
});
}
},18000000,18000000);