Hi, is it somehow possible to build app that can run both on Google Cardboard and Samsung Gear VR? For example it could be picked in options which device should be used. All in one application.
Not within the same apk no.
You have to make one of each. The google and occulus stores have different requirements for submission anyway so even if it were technically possible you would have a hard time making a single apk to satisfy both stores. Also the plugins for each both want to have control over the startup process for your app (displaying splash screens telling you to put the phone in your headset etc)
So you just have to do a build for one turn on/off some plugins restart the editor and do a separate build for the other. Annoying but not a huge pain.