Reputation: 11
When i see the native code.
BackHandler.exitApp()
will invoke android's onBackPressed()
Why not invoke System.exit(0)
to exit the app and kill process?
Upvotes: 1
Views: 3772
Reputation: 6027
You may use react-native-exit-app,
and replace BackHandler.exitApp()
with:
import RNExitApp from 'react-native-exit-app';
...
RNExitApp.exitApp();
...
Upvotes: 1
Reputation: 48602
Why not invoke System.exit(0) to exit the app and kill process?
System.exit(0)
is a bad approach to kill your application process. Android manage it in a awesome style. This made them to call onBackPressed()
Upvotes: 0