To make Ok Google detection work on Galaxy S7 (Galaxy series phones) we need to perform a couple of steps.
1. As long as Samsung S voice is enabled, it interferes with Ok Google detection.
So disable S Voice first.
Goto settings -> Apps -> S Voice -> Disable. If needed Force Stop the app.
2. Make sure S voice is no longer the default app for voice commands. Otherwise the phone will start it again instead of Google assistant.
Goto settings -> Apps -> Default apps -> Device assistance app
Make sure that the device assistance app is Google.
3. Make sure “Ok Google” is turned ON.
Tap the google search bar to go to the Google Now app. Tap the big G at the top left corner and then the three bars at the top left corner and choose settings -> Voice -> OK Google detection. Make sure that Ok Google detection is turned on and Trusted voice is turned on too. Train voice model.
4. Restart the phone. This is a crucial step.