How to check Android permissions at runtime?

Target API is 28 and minimum is 21.
I have a button that takes a photo and a button that gets the fine location.
How can I check permissions right when the app loads, instead of when the buttons are pressed?

The app always closes the first time each button is pressed.
I do not want that.

2017-04-11T00:37:33.809Z