Derci, tive exatamente o mesmo problema que você!
A solução que encontrei foi trocar o retorno da AsyncTask para Boolean e somente inserir a notifcação para iniciar a instalação, quando o download terminar. Algo mais ou menos assim:
UpdateTask update = new UpdateTask();
update.execute(APK_NAME);
Intent promptInstall = new Intent(Intent.ACTION_VIEW);
promptInstall.setDataAndType(
Uri.fromFile(new File(PATH_UPDATE + APK_NAME)),
"application/vnd.android.package-archive");
promptInstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
boolean updateOk = update.get();
if (updateOk) {
Log.d(TAG, "Update concluido. Iniciando notificação...");
generateNotification(this, "Atualização disponível",
"Clique aqui atualizar o seu aplicativo",
promptInstall);
} else
Log.w(TAG, "Update não concluido.");
} catch (Exception e) {
// TODO: handle exception
Log.d(TAG, "Erro no download do apk: " + e.getMessage());
}
2013/4/24 Felipe Aron <felipearon@gmail.com>
É o mesmo que estou usando aqui. Que estranho...A barra de progresso não está funcionando?--2013/4/24 Derci Santos <derciii.lima@gmail.com>
Estou usando um Tablet Sansumg Galaxy Tab 2 na versão 4.0.3--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Att,
Gabriel Augusto
013 97940055
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.






0 comentários:
Postar um comentário