現在、拡張するクラスを使用して、いくつかのデータを php Web サービスに投稿していますAsyncTask
。
データが送信されるとアプリがクラッシュしたというデフォルトの例外ポップアップを表示したいので、ここで同期呼び出しを行う必要があります ( previousHandler.uncaughtException(t, e)
)。
の非同期機能を無効にすることはできAsyncTask
ますか、それとも他に何か提案はありますか
これが私の現在のコードです、事前に感謝します:
public void uncaughtException(Thread t, Throwable e) {
final Writer result = new StringWriter();
final PrintWriter printWriter = new PrintWriter(result);
e.printStackTrace(printWriter);
String stacktrace = result.toString();
printWriter.close();
String deviceUuid = Utilities.DeviceUuid(ctx, cr);
String bluetoothName = Utilities.LocalBluetoothName();
AsyncTasks.ErrorLogTask logTask = new AsyncTasks.ErrorLogTask(e, bluetoothName, deviceUuid, stacktrace);
logTask.execute();
//task wont be complete before this code below runs since its async.
previousHandler.uncaughtException(t, e);
}