Hmm.. I reckon that's doable.
Solution would be - have a bracket to connect your phone (iOS or Droid, so long as it's got an accelerometer in it)
to your rifle stock - probably not the barrel because it would change the balance a fair bit.
Write an app to record phone movement and plot a point when the gun made a loud noise i.e. when you took the shot.
The difficulty would be the app figuring out if you were pointing at what you should have been pointing at when the gun went off.
Not easy, but doable if there was a market for it.