Greetings fellow developers and/or Android enthusiasts,
I wanted to take a moment to start a thread on for the Android application (2.2+) Backitude: Configurable Background Location Tracking. I would like a place to discuss the app publicly, discuss troubleshooting solutions, bugs, or motivate ideas and improvements.
Check out the Full version, ad-free available for free in the Android Market/Google Play store:
Download here: Backitude: Configurable Background Location Tracking
EDIT: Google Latitude shutdown their API on Aug 9, 2013 which completely changes the makeup of the application. Its sole purpose was to send locations to Google in order to maintain an accurate and timely history with Latitude. Now, it will be more geared towards keeping its own history and integrating with a number of systems or personal custom servers.
Backitude provides a bundle of extended features and functionality for updating Google Latitude locations from your Android device. If you are a Google Latitude user or once had interest in the concept of Google Latitude, then Backitude is an essential addon. Background gps location updating at your own specified time interval is now within your realm. Backitude expands your updating options, accuracy, and even allows you and your friends to force updates on eachother when needed, all seamlessly behind the scenes.
I created this app about a couple years ago to address two issues: I wanted to fix the short-comings of Google Latitude and make it a plausible application for users to enjoy and utilize effectively and efficiently. Also, I wanted to provide Google Play Store with such functionality free of charge. At the time, no such free application existed.
Google Latitude is somewhat inadequate on its own, but this is of no fault of the Google developers. They designed the application with battery efficiency as a number 1 priority. The conserve battery, Latitude on its own does not update locations in the background using GPS for accurate reporting. Instead it relies on Wi-Fi and cell tower triangulation to determine your location. Since many users refrain from enabling Wi-Fi when not stationary in their own network, or since Wi-Fi cannot be obtained while travelling, the resulting location updates are large, inaccurate "blue circles" on the map. Cycling through your Latitude friends, I mostly would see large, city-wide, inaccurate location readings- like I said, therefore truly defeating the purpose of Latitude. Latitude also fails to give the user any configurable options to location reporting. What good is a location history if majority of the values are city level and inaccurate? Backitude, to the rescue.
Backitude was designed to address all of this and put the power back into the hands of the user. You have complete control what, when, and how to update. Power can be a dangerous thing however. Google chose not to give the user a chance to configure their settings and risk draining batteries and having Android or Google products labelled as "battery drainers." Backitude is for the intelligent user, to know how to manage their battery, know their priorities, and know the effect of such functions. GPS polling is a very battery-intensive maneuver!
The final issue and gap Backitude inspired to bridge is updating a friend's location. It is great to have control over your location updates and allowing your friends to see exactly where you are, but what if they haven't updated recently or exactly when you needed to know their location? Backitude has an answer for that. "Fire an Update on a Friend" is the newest feature which utilizes SMS messaging to receive requests from other Backitude users. If your friend is also using Backitude and has this option enabled, you can send a request to their device which will in turn trigger an update at that very moment.
Additionally, there are many, many more features that all serve to give the user complete control of Latitude updates and battery consumption (in the context of Latitude updating). Thank you for checking it out, and I look forward to supplying any troubleshooting information right here for all to find, and hear ideas and feedback from those other enthusiasts out there.
Troubleshooting Topics
Location Updating using Backitude: the application utilizes oAuth2 authentication which is very easy and very convenient for the user. The user is able to grant permission for Backitude to integrate with their Google Latitude account at a click of a button without even having to enter their credentials.
The issue is, some users on some devices have experienced trouble obtaining this permission. It is important that users do one of the following before using Backitude, however, for some users it is required that they do both:
1) Use the Maps application to "activate Latitude for this device" by signing into Latitude. (Additionally, it is suggested that the user change their Latitude location reporting to "set your location". By manually updating your location and selecting an arbitrary position, you will prevent Latitude from wasting unnecessary battery life on updating your location, but still allow your friends to see your location. Backitude can do all your updates for you instead.)
2) From a PC or computer, visit Google Latitude and sign in from your browser. (And not from a tablet or smartphone browser) I do not know why this is required, but for some, to fully opt into the Google Latitude agreement and conditions, this is required.
After doing so, 99% of users are able to update using Backitude. An extreme minority, still have to perform some additional steps. This would include resetting your Google 3rd party authorizing sites, by revoking access from all, and then trying the process over from start. Signing into Maps. Activating Latitude. Installing Backitude..etc Any issues, I am always available via forum or email. Thanks!!
I just started using this app a few days ago after realizing how often Google Maps is polling for location information just to update latitude... Hundreds of times a day, even when I'm not moving!
So far, I'm liking what this app has to offer
Troubleshooting Topics: Location Updating using Backitude
If all else fails to get you updating, the following detailed description may help get you going as a last resort. Again, I'm not sure why oAuth2 can be so difficult for a small handful, and so convenient for so many others.
Start fresh by trying the following steps to reset your Google Latitude permissions
* From your android device, launch the Maps > Latitude application and Sign out. On the latest version, this is accomplished by going to Latitude > Menu > Location settings > Location reporting > Latitude location sharing > Sign out of Latitude
* Next, go into Android > Settings > Applications > Manage Applications > Maps and click the "Clear data" button.
* Similarly, uninstall the Backitude application by completing the following: Android > Settings > Applications > Manage Applications > Backitude and click the "Uninstall" button.
Now, follow these steps from a PC browser to remove access (so that we can then add them back)
* Visit google.com
* Sign into Google using the account you are trying to configure for Backitude
* Go to Google Account settings, or click "Account". (I will post a link directly there when I have the ability too)
* Scrolling down, you see the option to "Visit the previous version of the Account settings screen" which takes you to My Account.
* Under Security, select the link for "Authorizing applications & sites" (accounts.google.com/b/0/IssuedAuthSubTokens)
* Revoke access to any applicable "Android Login Service" entry including those such as "Full Account Access" and "Google Latitude"
Everything is now successfully reset, so perform the following steps in order.
* Sign into Latitude from a PC browser. (It is very important to sign in from a PC browser and not your android device at first). This is required by some devices for authentication purposes, to "opt" your Google account user into Latitude.
* Enable Google Latitude on your device using the Latitude app. If multiple accounts exist on your device, you may have to select the appropriate account by going to Maps > Menu > Settings > Switch Account. Then, or otherwise, sign-in to Latitude from your android device.
* Finally, you can try to re-install Backitude and successfully update your location to Google Latitude.
And that always seems to get the last 0.01% of users updating successfully who couldn't before. Annoying, yes!
Other similar 3rd party Latitude apps appear to be using a variant of oAuth1 authentication, which requires entering your password. I have contemplated implementing the same, to avoid this issue but perhaps future versions of Maps and Android will better activate permissions on those devices.
Backitude: My settings
How do I configure Backitude to run? Personally, with battery efficiency in mind while leaving the highest priority features enabled.
Enable Service: on (this is essentially the on/off switch)
Advanced Settings
Set Priority: Wi-Fi, with GPS/Tower Triangulation backup (One of the most overlooked but favorite options. This setting will abort GPS polling if a Wi-Fi network is present and the Wi-Fi location is accurate. So, in a real-life situation, my phone is indoors at work or at home with Wi-Fi enabled. GPS is enabled but not going to be able to get a fix indoors. Instead of polling for the entire extent of the Polling Timeout, Backitude will abort polling, and update using the Wi-Fi location value, which is all it ever would've gotten anyways. Beyond that, if I am outdoors and away from a Wi-Fi network with the same setup, the GPS will still poll and run its course as normal.)
Settings
Time Interval Option: 30 minutes (if my friends need a more recent update, they can ping me and have backitude fire off an automatic update seamlessly in the background)
Location Polling Timeout: 15 seconds (The longer GPS is allowed to run, the more potential battery gets burned if you can't acquire an easy fix)
Latitude Re-Sync Rate: off (this feature is only needed to prevent Latitude from overwriting your Backitude location update. However, I put my Latitude location reporting to manual so Latitude is no longer detecting my location. Battery saver too!)
Min. Change in Distance: off (I'm not a Location History keeper, so eliminating repeat updates is not a concern for me)
Location Steals: On (This is one of my favorite features. If you're using an app such as Maps, Navigator, or even the Internet, which polls your GPS, Backitude will steal this location and use it to update your location. The battery-intense function is already on-going thru another app, you might as well steal the location value and update your Latitude at very little expense.)
Accurate Update Only: On (You have to think about location "circles" for this option. Circles coming from inaccurate location readings. If your previous location value was more accurate then the current location reading, and the previous location is within the location perimeter of the newest location, it will repeat the more accurate location.
Real-time Enabled: Off (This is for individuals wanting to update at a faster rate when charging their device or docked. Personally, I just change my update interval when I want to update faster)
Real-time Interval: n/a (Users tend to want to poll location and update at a faster rate when their device is docked and battery is no longer a concern)
Real-time Timeout: n/a (When real-time updating, there is a separate timeout value for GPS polling versus the normal timeout. Users may have a different preference if their device is docked so there is a separation configuration for that)
Push Enabled: On (Allow friends to force an update to Latitude on my device by simply texting "Force Backitude update". I can get away polling at a slower rate and save battery because all my friends and fellow Backitude users know they can force an update on me when needed)
Display Message: off
Display Push Notif: off
Status Bar Icon: never
Display Update Message: off
Display Update Failed Notification: off
EP2008 said:
I just started using this app a few days ago after realizing how often Google Maps is polling for location information just to update latitude... Hundreds of times a day, even when I'm not moving!
So far, I'm liking what this app has to offer
Click to expand...
Click to collapse
Thanks. I'm currently working on fixing a couple known issues, and hoping to get a new release out this week. Nothing earth shattering though. I noticed you were running ICS... have you noticed any issues? I have not tested ICS compatibility yet, so I was always curious. Using a Bionic myself, I'm still hoping to get an update later this year and try it out myself. Thanks!
backitude said:
Thanks. I'm currently working on fixing a couple known issues, and hoping to get a new release out this week. Nothing earth shattering though. I noticed you were running ICS... have you noticed any issues? I have not tested ICS compatibility yet, so I was always curious. Using a Bionic myself, I'm still hoping to get an update later this year and try it out myself. Thanks!
Click to expand...
Click to collapse
No issues that I've seen.
I did have a bit of frustration when testing it as I had it set not to update unless my location changed more than 100m, so when I fired a manual update, I assumed that would force an update regardless of the location setting. It wasn't until after I turned that setting off did the manual update refresh with a new location timestamp.
Not a huge issue, but for some time I didn't think that the app was working because the timestamp on the history log never changed after manual updates.
Sent from my Galaxy Nexus using Tapatalk 2
EP2008 said:
I assumed that would force an update regardless of the location setting.
Click to expand...
Click to collapse
I never thought of that. That is probably a fair assumption. I may have to consider re-working that logic, so that like you said- if "Fire Update" is launched, you do not consider skipping the update because of minimum distance rules. Thanks!
backitude said:
I never thought of that. That is probably a fair assumption. I may have to consider re-working that logic, so that like you said- if "Fire Update" is launched, you do not consider skipping the update because of minimum distance rules. Thanks!
Click to expand...
Click to collapse
The reason I made the assumption was because I use an app called FolderSync, which helps manage cloud file storage services. With it, you can setup rules to sync your files, like what time a backup should be made, if you are plugged into a charger and if you are on wifi, etc. The app has an option for the user to initiate a manual sync, which basically ignores all scheduling rules over the users desire to sync right now. That's why I thought it might be the same for Backitude.
EP2008 said:
...The app has an option for the user to initiate a manual sync, which basically ignores all scheduling rules over the users desire to sync right now. That's why I thought it might be the same for Backitude.
Click to expand...
Click to collapse
I like the idea. I am going to change that for the next release. The settings for Backitude are pretty intimidating, even for novice Latitude users. I want to make it as user-friendly and straight forward as possible. Thanks for the help!
Still no way to see other people on Latitude? I'm sure it must be an API you don't have access to or something of that nature, but I still don't get the point of this app if it's "write-only". You can't see anyone, only they can see you.
You're correct in that the API is very limited. It only allows you access to your own location and location history, so there is no way to retreive your friends' locations, or even your list of friends. The purpose of Backitude is not to replace Google Latitude, but simply help correct its short-comings. Using backitude, and having your friends use backitude, ensures accurate locations, battery efficiency, and a means to update your friends' locations when you need their location. Once configured, Backitude runs in the background and can remain fairly transparent to your day to day Latitude use.
I'm using your app too in ICS 4.0.4 if you need some feedback. It's working quite well, even better than the other one! Keep the good work.
(Currently testing 2.7) Here is the change log, let me know if there's any more bugs I need to iron out last minute. Thanks!
Backitude: Update release 2.7 Changelog
1. Reported Issue: Backitude just stops running after a couple hours of use. (Unconfirmed but occasionally reported bug) I haven't been able to duplicate, however this could be the result of Android's memory management as an operating system, or the result of a Task Manager, task killer type of process. Users who experience such an issue should add Backitude to the ignore list on their task managers. However, I have made some changes in the code that may help.
2. Enhancement: For IOException, SocketTimeoutException, Read timed out, Unresolved host name. Backitude now has a re-attempt feature that will retry update after 60 seconds from a failed update due to these network congestion exceptions. (As directed to do by Google)
3. Enhancement: Implemented notification for users who cannot update due to permissions problem. (403/503 exception) Instructing user to first login to Google Latitude from a PC browser to "opt user into Google Latitude" and/or reset their Latitude location manually again. Google sometimes implements new terms and conditions and it may be required to re-opt into their agreement.
4. Enhancement: Updated Java Client libraries and Google Latitude libraries. I am hoping this shows improvements with efficiency, speed, memory, and issues.
5. Issue: (GUI) Steals option is not disabling if the Time Interval is under 5minutes. Likewise, it should then enable if the Time Interval is switch to greater than 1minute, similar to the behavior of the Re-Sync Rate option.
6. Reported Issue:*Wifi turns off after an update when Wifi Wake lock is enabled. Backitude now checks to see if Wi-Fi is connected (and therefore not sleeping) before acquiring a Wi-Fi wake lock.
7.* Change: "Fire Update" does not update location if minimum required distance is configured and new location is not outside of the bounds of previous location. Fire Update, since it is a manual update, has been changed to not consider the minimum distance configuration and bypass this validation.
8. Issue: Steals and manual updates (Fire Update) are not resetting the Time Interval clock after a successful update. This issue has been resolved.
9. Issue: Minimum distance calculation not taking into consideration changes in accuracy. If accuracy changes greatly from one location poll to the next, the location centers could be drastically far apart although the device has not moved. Offsetting the accuracy changes will result in better results for calculating change in distance.
10. Change: Push Update notification labels have been updated.
Well thats a nice application. Just starting to use it.
I have a suggestion. As my phone goes at night in a kind of sleeping mode - Wifi off, 3G off, Wifi Off, etc. - i would like to have a function to disable Backitude for certain hours or much better a Tasker Plugin.
What do you think ?
Thomas_BA said:
Well thats a nice application. Just starting to use it.
I have a suggestion. As my phone goes at night in a kind of sleeping mode - Wifi off, 3G off, Wifi Off, etc. - i would like to have a function to disable Backitude for certain hours or much better a Tasker Plugin.
What do you think ?
Click to expand...
Click to collapse
Thanks, glad you like it so far!!! It's funny you mention that because I have two main goals for the summer. Tasker integration and off-line storage/sync. I looked into Tasker once before over the winter and it turned out to be a lot more work then expected so I put it off, as this is just sort of a hobby in my free time. But with baseball season upon us, I do a lot of coding with the games on. Go Sox!
In the mean time, there is a setting for wake locks in Advanced Settings for Backitude. You can turn disable the wake locks and Backitude will not run once your phone goes into sleep mode. This means that the gps will not run while sleeping..etc Hope this helps
Nice to read hat you planning a Tasker integration/plug-in.
Yes for the time being i have disabled both wake locks. Disadvantage is that my phone sleeps a lot . I have my display timeout set to 1 minute, so sometimes my phone is sleeping for an hour while walking around in Buenos Aires or Argentina. Anyway for now this is the only solution. Looking forward to your next developments.
Thanks.
Thomas_BA said:
Yes for the time being i have disabled both wake locks. Disadvantage is that my phone sleeps a lot . I have my display timeout set to 1 minute, so sometimes my phone is sleeping for an hour while walking around in Buenos Aires or Argentina.
Click to expand...
Click to collapse
Actually, it shouldn't be that bad. Backitude will only cease functioning without wake locks once the device goes into a "deep sleep mode." I am not sure about the specifics of when this occurs, but it's separate then just display timeout. Can even take up to an hour or more from what I read, so as long as you're using it every hour or so, it should continue functioning. Please post your findings though, I am intrigued now.
I will observe the pushing frequency to Latitude and keep you informed.
I've been using Backitude for a few months now.
However, even with WiFi Wake Lock enabled, it seems the accuracy of my updates does not improve. However, when I open google maps with WiFi already on, the accuracy is few meters (I work and live in a dense WiFi area).
Do you think that Backitude for some reason is not turning on the WiFi, or is WiFi based localisation not being picked up by latitude?
Thanks for a great app!
When using the internet on your device that has an active carrier data plan and no WIFI network is available, the device automatically switch to carrier's data plan.
There are many instances where people with limited monthly plans have run into bloated bills due to unintentional excess data usage.
I searched far and wide across the forums, to find any tips, tricks, tools or best practices for optimized data usage, but could not find much.
This is my humble attempt to come up with such a list.
Hopefully this will help someone avoid those surprise excess usages and bloated bills.
Please bare with me if this is insufficient or if the information herein becomes outdated due to new features in latest Android versions.
I'm not an expert. I am kind of a half-noob myself
1. Install a Data Monitor application.
There are applications which help you monitor data usage.
They show how much usage has happened through carrier's packet data and how much is through WIFI.
They also show data usage per application.
If your ROM does not already have these features, there are so many applications available on the android market (Google play store).
Search for one that suits your needs. I personally prefer My Data Manager
Note that all these data monitor applications monitor the usage at real-time.
That means, they can only monitor your usage form the day you installed them. Don't wait till you run into an excess usage problem, install one now.
2. Explicitly turn off packet-data during huge WIFI downloads.
If you are downloading huge data over WIFI (say a 600 MB file), and in-between if your WIFI becomes unavailable, chances are that the phone switches automatically to carrier data and continues with the download.
This is a sure shot scenario to cause surprise excess usage.
The WIFI might become unavailable due to any number of reasons like:
Straying out of the signal area - if you are moving around
Source getting disconnected - I have a cabled broadband with unlimited data on my laptop, I make my laptop a WIFI hotspot (kind of reverse tethering) using a USB adapter (wireless N150 USB adapter from buffalo). Whenever there is a power cut, my broadband connection goes off until I manually reconnect. Also, my connection periodically times off if it's on for a long time, or my laptop might restart.
The router might malfunction or in worst case, the phone's WIFI connectivity might itself dysfunction.
The point is, keep in mind that the WIFI can go off half way through the download and you might end up using carrier data.
The best solution is to turn off your carrier data. [Uncheck Settings -> Wireless and network -> Mobile networks -> Use packet data]
You can turn it on once the download finishes or once you have stopped/paused the download and you are sure that it won't use up your packet data.
This way, you can ensure that you are actually downloading through WIFi.
3. Firewall - allow/disallow data access to individual applications.
There are firewall applications on the market that allow you to:
Block internet access to selected apps.
Many apps like offline games and simple tools require full internet access permission. At first glance, this looks suspicious as these apps do not seem to have any business going online.
The main reason most of them use this permission is to allow in-app Ads.
By using firewalls, you can block internet access to selected apps that do not require internet access for their normal functioning.
Separate packet (3G/GPRS) and WIFI data.
Some apps consume too much data, like Facebook, Google plus and some games.
If you don't need to be online on these apps all the time, you can allow them only WIFI access, so that they can sync only when WIFI becomes available and they can never use up your carrier data.
Toggle blocking status.
Useful when you want to occasionally turn it on for a while.
There are many such firewall apps available on the market and some antivirus apps also come with inbuilt firewall features.
I personally use DroidWall
Note:
Provide access to all android system applications, and apps which come pre-configured from your vendor (I guess they could be trusted)
Make sure all apps that require internet access are given the access - both in WIFI and 3G mode.
Make sure known data guzzlers are denied access - both WIFI and 3G (provided they do not require access for their normal functionality)
If in doubt about any particular app - I prefer to provide it access. Better safe, than risk impaired functionality.
4. Download Manager - pause/resume downloads.
Say you are downloading about 10MB of data and the connection drops when you are about 8MB completed.
At this situation, you do not want to start downloading from scratch again when connection becomes available.
This way, if you are moving in and out of connection, you will end up trying to download the same data again and again, drastically increasing the usage.
You need a download manager with pause, resume, auto resume features to handle this situation.
There are many available on the market, search and use a one that best suits your needs.
This works only for downloading from browser links, dropbox, etc.
The download manager does not come into picture if you are trying to download data directly from an app (like many games download huge data when started for the first time after installation).
I am yet to find an app which can handle this kind of situation. Something like - intercept any downloads initiated from within other apps, and provide you option to manage those downloads.
If anyone knows of any such app, please do update us.
However, most games and apps which do huge data download have inbuilt capability to manage the download.
For example, Sygic has an excellent download manager that manages maps and other downloads for it. It comes by default with Sygic.
5. Push Notification Detectors.
When you install certain applications, they might have tie-ups with certain advertisers to send add notifications directly to your device's notification bar.
Such ads are called push notification ads. They allow the developers to make some revenue and help keep the free applications free.
These notifications show up on your notification area periodically, even when the original application which installed them is not running.
As of now, I cannot find any statics/benchmarks to understand how much data push-notifications consume. But they definitely do consume some data.
It is a personal choice whether you want such notifications or not, I personally feel a little bit of data usage is OK, as it is a small price to pay and helps the developers.
But some applications might be tied up with greedy advertising schemes that do extensive push notifications and consume excessive data.
One best way is to go through the apps description carefully before installing.
If the developer clearly states that the app uses push notification adds, it shows some responsibility on the developer’s part and you can assume he has taken the steps to ensure that the notifications are not excessive and does not consume excess data.
You can then choose to either install or not install the application.
However, there are many applications which are silent about the fact that they use push notifications.
There are many detectors on the market which detect all the installed apps on your device which appear to use known notification Ad frameworks.
They do not block the Ads, but inform you which applications are causing them. You can then choose to uninstall those applications or give them only WIFI data access or freeze them for a certain period of time to monitor your data consumption.
I personally use AirPush Detector
6. Freeze / Unfreeze applications.
If you suspect some application to be causing excess data consumption through push ads, you can freeze it for certain time and monitor the data usage to check if there is any significant change.
There are many such applications on the market which allow you to freeze/unfreeze select apps.
Most of them require root access (I do not know of any such app which works without root)
Titanium Backup (Requires Root) is the best application out there as per my opinion.
It does much more than freeze/unfreeze. It's a must have app for any root user.
PS:
Be very careful which apps you decide to freeze.
There are many apps that should not be frozen, especially system apps and some of those that come preinstalled on your ROM.
If you try to freeze any such app which should not be frozen, you might render your phone unusable.
Please refer threads related to your device to get a list of safe-to-freeze apps for your particular device.
Rooting might void warranty and has an associated risk of rendering your device unusable if done improperly.
If you are unfamiliar with concepts, read through the forums here on XDA, use the search button
This is all I can think of for now.
If you have any more useful tips/tricks or best practices related to data usage, please add them here, so that it can help others as well.
Cheers,
Sandeep
My last android phone did not have this problem. I connect to my home VPN while at work. Ever since I got this phone the connection just drops every 10-20 minutes when the phone is sitting idle, or when I'm just listening to a podcast or something.
I don't know if it's phone related or android version related but I can't find any information on it. Has anyone else experienced this?
I tried looking through the power save settings to see if there was some option cutting data when the phone went idle but didn't find anything.
thoughts?
Thanks
check to see if battery optimization is on for your VPN app....Settings > Battery > (3 dots menu) > Battery Optimization > set your VPN app to Not Optimized. Honestly not well versed in how the VPN config works, but the activity you describe sounds very much like Doze (battery optimization) is kicking in and killing your connection. For example, I turn off battery optimization on my exchange mail app and other apps that I want to ensure stay active even if my phone is idle.
I have added VPNdialogs to the don't optimize list. I couldn't find anything else that was VPN related, but this doesn't seem like the proper app I need. Unless anyone knows what the VPN app is called?
Thanks for the suggestion, with any luck this will work.
Frontier3 said:
I have added VPNdialogs to the don't optimize list. I couldn't find anything else that was VPN related, but this doesn't seem like the proper app I need. Unless anyone knows what the VPN app is called?
Thanks for the suggestion, with any luck this will work.
Click to expand...
Click to collapse
no worries, good luck with it. you may wan tot explore some of the VPNService config information in the AOSP/Dev site here. This probably starts to get into the connectivity/network aspects of the optimization, and it's hard to say how those services are isolated from general phone connectivity and the battery optimization (that is, does turning off optimization for one of the potentially related services cause a lot of stuff to go out of optimization by detraction, which could hamper battery life significantly but not in a way that's immediately obvious). You could guess and check, but another method may be to reexamine your VPN app of choice. You could try free options like OpenVPN Connect, Open VPN for Android, or Speed VPN (all free) and see if you can run your vpn through them and control battery optimization at that app's level to better success. There's also VYPR (VYPYR? spelling?) that's free up to a limited amount of data usage and could be used in P.O.C. manner to test things out. Again, I'm not a VPN expert, but I did tinker with a few of these when I was recently in China (to no avail, but not due to the apps, due to China being very Chinese/Anti-Google).
That said, we still don't even know if this is Doze/battery optimization related, but it's worth eliminating as an obvious potential culprit. I fear I'm not going to be able to help much beyond this, but have used android as a "super-enthusiast" for many years. I can also ask my buddy at work tomorrow who's a network and security freak, he might know...
Just an update, putting vpndiags out of battery optimization did not affect the issue. It's still disconnecting regularly. When I find time I'll look through the dev link posted above.
In the mean time if anyone else has any ideas I'm all ears.
Just a random thought, but did you remember to check the always on box when you configure the VPN setup, so that it transmits a keep-alive packet across the tunnel to prevent disconnection?
Yeah I couldn't figure out what that button was doing. When I check it the connect button greys out. I tried checking it but it seemed like it wasn't doing anything. I'll play around with it a bit more. Thanks for the suggestion.