My Quick Notes

Ain't Nobody Got Time to Read

2 articles

How to properly exit Bevy app on Android

Normally, a Bevy application can exit with AppExit, like:

fn exit_system(mut exit_event: MessageWriter<AppExit>) {
    exit_event.write(AppExit::Success);
}

But on Android, that is not enough and can cause the app fails to reopen. To completely exit the Bevy application on Android, we need to exit on the Android side too.

 .--------------------------------------.           .------------------------------.
|                  Bevy                  |         |            Android             |
|   .------------.     .------------.    |         |   .------------.               |
|  |    system    |   |     main     |   |         |  | MainActivity |              |
|   '-----+-+----'     '-----+-+----'    |         |   '-----+-+----'               |
|         | |    AppExit     | |         |         |         | |                    |
|         +-+--------------->| |         |         |         | |                    |
|                            | |     exitAppActivity         | |                    |
|                            +-+---------------------------->| |                    |
|                                        |         |         | +---.                |
|                                        |         |         | |   | finishAffinity |
|                                        |         |         | |   |                |
|                                        |         |         +-+<--'                |
|                                        |         |                                |
 '--------------------------------------'           '------------------------------'
Read More...

Vim - Save file as root without reopening file

File requires root permission to be written, but sometimes we forget to add sudo before vim command. The result is after editing the file with a lot of changes, :w cannot save them. This can be avoided by adding a sim…

Read More...