The Android OS intentionally tries to prevent applications like this from running to prevent battery drain. For Android 6 specifically, you need to know about the doze and app standby features. Doze prevents applications from running when the device is not in use. App standby defers network activity for seldom-used applications. Both of these are likely affecting your usage.
Running GPS (actual GPS, not just location services), is a huge power drain.
If you don't care about power, you can try:
- Keep device on with your application in foreground.
- Whitelist your application for doze and app standby (see above link).