I have exactly the same issue with my Galaxy S6. It will only charge at random times, screen goes black, phone makes a sound, x in bottom left and right corners, then screen comes back on, repeat..repeat...totally random. Sometimes VR software starts up and asks me to install it.
For me this...