How to detect app installer

I would like to know if there is a library that can be used to detect if an app was installed from the official store.

Mmm, probably not. I dont know if there is any indicator that an app can signal where it was installed from. What are you trying to achieve?

I want my app to notify the user if the app was not installed from app store or play store

Yeah, I dont think there are native APIs to detect this.