How to determine if an application is already ignoring battery optimizations?

I wanted to make my app able to ignore battery optimizations, and I have done that successfully. However I can’t get whether the user has allowed it or not. i have read the reference from Settings | Android Developer, but i don’t know how to use it/place it using activity starter! can anyone tell me how to solve it? I would really appreciate your feedback! Thank You