I seem to have found my own answer. Unfortunately I do not know if I can answer it, but if I can not, I ask the moderators to correct and instruct me so I can understand better.
Well, in iOS we have the webcal, as I said earlier. Mounting links like this:
<a href="webcal://192.168.1.102/scripts/apptest/teste.ics">Agendar</a>
iOS opens the event right
To solve this problem, in the shouldOverrideUrlLoading of my webview, I check if the URL has the webcal, and open a new intent for the calendar, so I drop the ICS and set up a calendar. I know there are better ways to parse in ICS, but follow the code I used
Anyway, I now have the same HTML working for both devices
// Verifica se começa com o protocolo de calendario (webcal para manter padrão com ios)
if(url.startsWith("webcal")) {
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
try {
// Cria o link para o ICS
URL urla = new URL(url.replace("webcal", "http"));
// Coloca em buffer todo o texto
BufferedReader in = new BufferedReader(new InputStreamReader(urla.openStream()));
String str;
// Inicia o calendario e percorre linha à linha
Calendar cal = Calendar.getInstance();
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
while ((str = in.readLine()) != null) {
/*
Verificar de não ter espaços entre o :
Não usar Z no final do datetime
*/
// Verifica data de inicio
if(str.contains("DTSTART:")) {
// Cria o formato da data e da o parse
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
Date date = format.parse(str.replace("DTSTART:", ""));
// Adiciona o parametro
intent.putExtra(CalendarContract.Events.DTSTART, (date.getTime()));
}
// Verifica data de fim
else if(str.contains("DTEND:")) {
// Cria o formato da data e da o parse
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
Date date = format.parse(str.replace("DTEND:", ""));
// Adiciona o parametro
intent.putExtra(CalendarContract.Events.DTEND, (date.getTime()));
}
// Verifica o titulo
else if(str.contains("SUMMARY:")) {
intent.putExtra(CalendarContract.Events.TITLE, str.replace("SUMMARY:", ""));
}
// Verifica o organizador
else if(str.contains("ORGANIZER:")) {
intent.putExtra(CalendarContract.Events.ORGANIZER, str.replace("ORGANIZER:", ""));
}
// Verifica o local
else if(str.contains("LOCATION:")) {
intent.putExtra(CalendarContract.Events.EVENT_LOCATION, str.replace("LOCATION:", ""));
}
// Verifica o descrição
else if(str.contains("DESCRIPTION:")) {
intent.putExtra(CalendarContract.Events.DESCRIPTION, str.replace("DESCRIPTION:", ""));
}
}
// Fecha a conexão
in.close();
// Inicia o intent do calendário
startActivity(intent);
} catch (MalformedURLException e) {
Log.d("Log", "Erro: " + e);
} catch (IOException e) {
Log.d("Log", "Erro: " + e);
} catch (ParseException e) {
Log.d("Log", "Erro: " + e);
} catch (Exception e) {
Log.d("Log", "Erro: " + e);
}
return true;
}