Related
The ad revenue from this app has passed the $25 mark -- what it cost me to register with Google to put the app in the market. As promised, any revenue the app earns from that point forward will be added to my annual donation to the Baypath Humane Society of Hopkinton, Massachusetts -- a no-kill shelter.
Thanks from me and thanks from the kittens and puppies.
----------
I've written a widget to establish a PAN connection between the Nook a phone. It grabs the first networking-capable device it finds in the list of pairings. A couple of things to note:
There is an application. All it will do is show you what device, if any, it can connect to. It has to turn on Bluetooth to get the list, but it will politely ask you before doing so.
The widget will turn on Bluetooth, but it isn't so polite. For the life of me, I can't find a code snippet nor can I think of one that will start the polite activity (or any activity) from a widget that doesn't directly involve a button press. If anyone has such a snippet, I'd love to see it. I know its possible because the Bluetooth GPS widget does it. Fixed!
The widget, of course, requires root.
I do send a Toast when the process is complete, but toast from my widget isn't reliable. I need to figure that out, too... advice is welcome. Fixed!
Still to do: Monitor the connection and reflect the status in the widget. Fixed!
If nothing else, it's prettier than a GSCript script. Once it's stable and complete, I'll stick it in the marketplace.
Note... You must be running CM7 and you must have already paired the phone before you can use this....
Apr-13: New version with better Bluetooth device state management.
Apr-17: Added connection monitoring, polite Bluetooth enabling
Note: The pop-up to grant superuser access is asynchronous, so there may be a timing window on first use where state is not correctly monitored. I'll try to work that out, but in the meantime, all subsequent uses should work.
The icon will display a yellow LED during the connection process and a green one once the connection is going.
If a connection could not be established, the LED may go briefly green, then turn off. The challenge is that the only way I can monitor the connection is with "pand -l" or "ifconfig bnep0" and if the connection is gone, the attempt to read the result from those commands simply hangs. So, I start a thread and then periodically run "pand -l". A different thread monitors the first and, if it looks stuck, I kill the process and turn off the LED. But, until I can be sure it's really stuck and not just taking time to answer, the LED will be green. Fixed!
Obviously, once the connection is broken, the LED will go off.
Since I have the LED, I've taken out most of the toast, though some still comes from the OS.
Apr-19 Fixed the widget graphics so the LED turns off instead of disappearing. Fixed the green-before-failed connection status issue. Added a proper toggle -- if the connection is off, tapping the widget turns it on and if the connection is on, tapping the widget turns it off.
Apr-20 The official version is now in the Market:
https://market.android.com/details?id=earlmagnus.nctether
May-27 Fixed a null pointer issue discovered by Ophbalance
As always, feedback is welcome.
Could you accomplish the blue tooth polite toggle with a conditional method?
Check blue tooth status,
if off, direct user to settings-> blue tooth
I know thats not as cool as a nice button press
Downloadin ur app now!
One other oddness...
... Android doesn't seem to think the tethered connection is worthy of note. If you start the browser after being connected, you'll be told you have no connection. Pages will load perfectly well, anyway.
sinanju said:
... Android doesn't seem to think the tethered connection is worthy of note. If you start the browser after being connected, you'll be told you have no connection. Pages will load perfectly well, anyway.
Click to expand...
Click to collapse
I'm pretty sure it's because Android does not natively have bluetooth DUN capabilities, at least input-wise; it's based on functions within custom kernels, and therefore the system does not recognize it as a connection capable of fueling GApps.
But I could be completely wrong / that information could be outdated; this is from my research into Bluetooth DUN for my Nook when I first got it a while ago, and I'm not much of a developer. I'd more call myself someone who likes dabbling with code, and watching everything break.
But back to this post's point: thank you so much, you are a god. I've been looking for an easier way to do this for so damn long.
Kudos, sir. Kudos.
This is very promising! Now, what is the feasibility of adding Bluetooth DUN support? A number of phones out there (to include Blackberries) do not support PAN. I've done a lot of googling and have come across one resource, which may or may not be useful: https://github.com/wertarbyte/android_vendor_cyanogen/blob/omni-tether/prebuilt/common/bin/tether
The "pand" binary is included with the CM7 ROM, but "dund" is not. How much effort would be involved in adding this functionality?
Thanks in advance and appreciate any guidance..
exactly what i was looking for.
Thanks a lot for this. Will be installing and tethering to my iphone via mywii
I will report back with results.
anonim1 said:
This is very promising! Now, what is the feasibility of adding Bluetooth DUN support? A number of phones out there (to include Blackberries) do not support PAN. I've done a lot of googling and have come across one resource, which may or may not be useful: https://github.com/wertarbyte/android_vendor_cyanogen/blob/omni-tether/prebuilt/common/bin/tether
The "pand" binary is included with the CM7 ROM, but "dund" is not. How much effort would be involved in adding this functionality?
Thanks in advance and appreciate any guidance..
Click to expand...
Click to collapse
DUN is in a whole different ballpark. I don't know what's involved.
Thanks, folks, for trying it out. I have an idea for monitoring connection status, but other than some POC work, I probably won't get to it before the weekend.
It doesn't work for me, it says tethering then tethered and then starts tethring again and this goes on quite sm time and then the internet doesn't work, i really needed this:-(
am running pherimod 5.3 and trying to tether with sony erricsion's k530i which has bluetooth networking.
rigy73 said:
It doesn't work for me, it says tethering then tethered and then starts tethring again and this goes on quite sm time and then the internet doesn't work, i really needed this:-(
am running pherimod 5.3 and trying to tether with sony erricsion's k530i which has bluetooth networking.
Click to expand...
Click to collapse
Does the application show the the phone and its BT address?
Is there a particular app you have to start on the phone before you begin tethering and, if so, does it show status if a link is established?
EDIT: Also... have you used the phone for tethering before with a laptop? Do you know tethering should work?
For the life of me, I can't think of anything that would make it loop through connection attempts other than mashing the widget repeatedly.
sinanju said:
Does the application show the the phone and its BT address?
Is there a particular app you have to start on the phone before you begin tethering and, if so, does it show status if a link is established?
EDIT: Also... have you used the phone for tethering before with a laptop? Do you know tethering should work?
For the life of me, I can't think of anything that would make it loop through connection attempts other than mashing the icon repeatedly.
Click to expand...
Click to collapse
Yes phone and address are both shown, i start tethring by taping the widget and as for the status i see nothng xcpt bluetooth icon, which shows that both the devices are connected. But am trying this with a gprs connection. i havent tried 3g yet, will that be any different?
Yes the phone has bluetooth tethring, the pc suite has a module for bluetooth internet.
I've attached a new version in the OP. Have a try.
I've improved managing the Bluetooth device. Final state of the connection still isn't reported... that will have to wait.
I would remove the widget and uninstall the old app before installing the new version.
Hm... pand --nodetach doesn't do what I hoped it would in a --connect context... So much for that idea.
I'm trying to use this app to tether my nook to my moto Droid. When I tap the widget it says there's no paired PAN device. I've tethered these two before using the pand command, so I know it's possible. Am I doing something wrong? The droid and nook are "paired but not connected", but every Bluetooth device has said that.
Sent from my NookColor using Tapatalk
Calla969 said:
I'm trying to use this app to tether my nook to my moto Droid. When I tap the widget it says there's no paired PAN device. I've tethered these two before using the pand command, so I know it's possible. Am I doing something wrong? The droid and nook are "paired but not connected", but every Bluetooth device has said that.
Sent from my NookColor using Tapatalk
Click to expand...
Click to collapse
They were probably paired while the droid wasn't advertising the profile. I rely on the list of paired devices knowing which is the network provider.
Try this:
- Remove the Droid from the list of paired devices on the Nook
- Enable visibility on the Droid
- Get the Droid ready for a PAN connection
- Then, from the Nook, initiate pairing
That should ensure the Nook sees the Droid can provide a network connection.
Now I just need my phone to just advertise the bluetooth network without having to run wifi tether.
painter_ said:
Now I just need my phone to just advertise the bluetooth network without having to run wifi tether.
Click to expand...
Click to collapse
Nothing WiFi related will help you.
My WinMo 6.5 phone just shows a list of nearly a dozen profiles it supports, PAN being one of them. My suggesting about getting the phone ready for PAN before pairing came from my experience setting up my Ubuntu system as a tethering client. Both that and the Nook recognized the PAN profile when I did that.
The only app I could find that supports bluetooth tethering and is reliable on my HTC Hero is wifi tether set up in bluetooth mode. I have been using it for over a year with my netbook.
What would make the bluetooth tethering the cat's ass would be to not to have to start anything on the phone, for the connection to always be available so i could just wip out the nook and be able to use the data connection.
painter_ said:
The only app I could find that supports bluetooth tethering and is reliable on my HTC Hero is wifi tether set up in bluetooth mode. I have been using it for over a year with my netbook.
What would make the bluetooth tethering the cat's ass would be to not to have to start anything on the phone, for the connection to always be available so i could just wip out the nook and be able to use the data connection.
Click to expand...
Click to collapse
Can't help you there... that's up to the phone.
In my case, it's an HTC Topaz and I have to start an app on that, too...
I am happy to report it works well with mywii running on my iphone and tethering from the nook.
Did not have any issues at all. And yes, i did have to hold my iphone the right way
I searched and searched, but found nothing. When I have my laptop connected via the Wifi Hotspot, sometimes the connection will hang and then time out. If I simply wake the screen up 99% of the time it will begin to download the data and my web page will render on my computer. I am on ATT with Alien/Khlolks Kernel/.30p Radio. Does anybody else have this problem? It can be really annoying sometimes. Thank you
I dont have this problem with Wireless Tether.
Thanks a lot! I've been using the app you recommended and the speed and stability seem to be far better than the one packaged with the alien rom.
Its one of my favorite apps, and arguably the number one root app to have since it potentialy could save you $20/mo. There is a link in my signature to a list of root apps compatible with the Atrix if you are interested.
Google Now gave me a rather interesting message: For better location, please enable Wifi. This works even when not connected to a network.
How can the phone figure out my location by using the Wifi antenna without connecting to any networks?
Here's how I originally thought it worked: The phone sees what cell towers are available, then uses data or Wifi to look them up in a database and determines a likely location. But now the app is telling me it really just wants the wifi antenna on. Why?
Because its like when you turn on your Bluetooth it scans near by devices..you connect with them or not its not the question but you can know that how many devices are in your range got it..
Same like when you turn on wifi it searches near by connection you connect or not Google find out your near by wifi networks.. By using that nearby wifi network already registered they find you approximately locations..
we all should be polite enough to press thanks for anyone who helped US.
Oh. Then Google records the location of Wifi networks, so visible networks can be used for location lookups?
Actually, that makes sense. I remember a couple years ago they got in trouble for wardriving and said it was unintentional. It could have been related to an effort to record the location of all visible networks.
That makes sense, but I'm running JellyTime on an Inspire, and it doesn't have the biggest battery. I don't want to leave wifi on all the time. Would it make sense to use Tasker to turn wifi on for a few minutes every hour, or would Google Now even be able to gather enough location info in such a short time?
Longstreet said:
That makes sense, but I'm running JellyTime on an Inspire, and it doesn't have the biggest battery. I don't want to leave wifi on all the time. Would it make sense to use Tasker to turn wifi on for a few minutes every hour, or would Google Now even be able to gather enough location info in such a short time?
Click to expand...
Click to collapse
Why not test it without Wifi? Leave google maps open with Wifi/GPS disabled while you're traveling. If that looks reasonably accurate, just leave them off.
As for timing, the phone can tell your location pretty quickly, but I don't know how Google Now is written. It would probably need to have specific logic that says "check location whenever wifi gets enabled". I'm not sure whether it does.
fenstre said:
Why not test it without Wifi? Leave google maps open with Wifi/GPS disabled while you're traveling. If that looks reasonably accurate, just leave them off.
Click to expand...
Click to collapse
That's what I've been doing. It works so far, I was just wondering if there was a better way.
It just doesn't seem to do much beyond weather and sports. Maybe I haven't used it long enough. Or maybe my life is so freaking boring it doesn't have a lot to work with!:laugh:
As for timing, the phone can tell your location pretty quickly, but I don't know how Google Now is written. It would probably need to have specific logic that says "check location whenever wifi gets enabled". I'm not sure whether it does.
Click to expand...
Click to collapse
I'm wondering. There's a lot of info out there on what it does and how it does it. But I'd be interested in the nuts and bolts, finding out exactly what it's doing and when and how.
It is kinda neat. But kinda unsettling too.
My Wi-Fi is scanning constantly when already contacted to my home network successfully.
It is killing my battery. Visible difference with Wi-Fi on vs off in the battery graph
I have many things hibernated.
So I'm reading about this interval, wondering what the longest possible interval is as I turn off and on Wi-Fi manually, and I'd like to save my battery juice. Even idle but on Wi-Fi there's a big difference!
I'm on a rooted Samsung Galaxy s5 neo
And yes I've got it set to off already for it scanning even when Wi-Fi is set to off for Google networks.
Help?
Sent from my SM-G903W using XDA-Developers mobile app
Anyone?
Sent from my SM-G903W using XDA-Developers mobile app
Does WiFi not kill anyone else's battery? Orrr... ?
Sent from my SM-G903W using XDA-Developers mobile app
For being the third Google result when searching for "wifi supplicant scan interval", this thread's lack of feedback is remarkable. I was wondering the same. I've now set it it to 600 because I'm really not that dependant on WiFi since I have a 4GB data plan. I don't mind if it takes a while to connect when I get home and with this setting it'll only check for a connection 50 to 60 times a day (during the 9 hours I'm away from home) but still enough when connected, I don't need updates to be more frequent than 10 minutes. We'll see how that goes.
Did you eventually end up altering it, @Pawprints1986 (look at that, we're from the same year!)? If so, what were your experiences?
I actually haven't altered anything. I don't have the supplicant line already in my build prop and I'm not sure where to put it or which value to use, or if it would work.
I tried adding a line into my s2 build prop but it didn't seem to actually respond to it, so I must have done something wrong, still searches every 2 seconds.
Sent from my SM-G903W using XDA-Developers Legacy app
I tried 720 Supplicant WiFi Interval and I have low issues. The signal to find new WiFi is still easy to get, albeit some waiting a little bit but saved a tremendous amount of battery.
I also disabled WiFi Scan completely and not know how I did it until just recently by using AppOpsXposed and disabling Location on settings. That stops WiFi Scan completely and only allows you to connect to your WiFi routers that you already connected to.
How would you force Android to scan for new wifi network manually? With that, we could have the best of the two world - long battery and fast switching when you need it.
After several years of trying different free and paid vpn's that won't drain my battery excessively I think I may have found the solution.
I have lifetime subscriptions for VPN Unlimited and Windscribe with Proton and Tunnelbear as my free ones. All drain the battery quite heavily. For the past 72 hours I've been using the Strongswan Ikev2 client to run Windscribe and it's been excellent. Zero abnormal battery drain. It's the first time I'm using Ikev2 and it's much more efficient than OpnVpn in terms of speed, battery and auto-reconnecting. The downside is that it only uses one port and can therefore be blocked by the isp or government, so if you live in a restrictive country then you're out of luck.
The screenshot below are my actual battery stats since I took the phone off the charger. This is despite Strongswan shown to be using about 35% of the battery.
I presume any Ikev2 enabled vpn will work just as well so you don't need to use Windscribe and I'm not endorsing them over any other vpn. Anyway give it a try and let us know how it works for you.
Update: Almost a week now and battery life is still normal. Looks like this really does work.
Yep, ikev2 is going to have much better speed and lower CPU usage on every platform (that's why it's used for Enterprise network vpns between firewalls). Also give wireguard a shot, extremely low CPU usage and battery as well
JedixJarf said:
Yep, ikev2 is going to have much better speed and lower CPU usage on every platform (that's why it's used for Enterprise network vpns between firewalls). Also give wireguard a shot, extremely low CPU usage and battery as well
Click to expand...
Click to collapse
Thanks for the tip. I'll check it out.
I'm not sure many people know about this because all the searches I've done show complaints but no effective solution to the battery drain. Ikev2 and the right vpn client should be top of everyone's list when considering a mobile vpn.
Twotems said:
Thanks for the tip. I'll check it out.
I'm not sure many people know about this because all the searches I've done show complaints but no effective solution to the battery drain. Ikev2 and the right vpn client should be top of everyone's list when considering a mobile vpn.
Click to expand...
Click to collapse
Agreed. One of the other reasons though that people prefer openvpn is that you can run it over tcp 443 so it's not likely to get blocked on draconian guest networks like ikev2 might.
JedixJarf said:
Agreed. One of the other reasons though that people prefer openvpn is that you can run it over tcp 443 so it's not likely to get blocked on draconian guest networks like ikev2 might.
Click to expand...
Click to collapse
Understood. Under those circumstances your original app will still give you the OpenVpn option. But for an always on vpn for mobile the combination of ikev2 and Strongswan is excellent. It's permanently connected on both my phones now.
Yeah, IKEv2 is the way to go, better security and less drain on the CPU/Battery. I set up NordVPN on the Strongswan too and experienced slightly better results than with the NordVPN app. Though the app itself isn't bad at all.
I'd also like to say that using IKEv2 protocol through strongSwan has fixed my Android VPN battery drain issues as well. I have traditionally been using the NordVPN client on my Android device and it definitely introduces a significant drain on the battery, which is now gone.
Hopefully anyone else with similar issues will find this topic with a quick search and can apply the same solution to their problem as well.
So I am new to setting up vpn manually. I have been using nordvpn app for a while but battery drain has kept me from keeping it on constantly or using androids kill switch.
I just installed openvpn connect amd strongswan and using nordvpn server through them for oenvpn and ikev2 protocols. Is that the right way to go about it? How do you select which server to use as there are 1000s of servers. Should I be importing all of them into these apps. How do I decide which one to use at any time.
I ideally want to be at a point where I can just leave it on all the time without worrying it will drop connection.
Thanks
vm81 said:
So I am new to setting up vpn manually. I have been using nordvpn app for a while but battery drain has kept me from keeping it on constantly or using androids kill switch.
I just installed openvpn connect amd strongswan and using nordvpn server through them for oenvpn and ikev2 protocols. Is that the right way to go about it? How do you select which server to use as there are 1000s of servers. Should I be importing all of them into these apps. How do I decide which one to use at any time.
I ideally want to be at a point where I can just leave it on all the time without worrying it will drop connection.
Thanks
Click to expand...
Click to collapse
It's either OpenVpn or Strongswan. You can't use both as they use different protocols and OpenVpn will continue to drain your battery. Therefore it's Strongswan you need using the Ikev2 of Nordvpn.
Just import the servers you want to use, set and forget. Windscribe has a specific set of instructions on this but I don't know how Nordvpn does theirs. It should look something like "us.central.nordvpn.com" with a password and instructions on which boxes to check and uncheck. Once you're set up you use the Strongswan client exclusively and select any server you've imported from there. No need to even have the Nordvpn app installed any longer.
Hope that helps.
Thanks for your response. I was planning to use only one at a time ikev2 or openvpn. I juat installed both to see how they compare.
Anyways, one of my questions is that how do i select which server to use. If i use nord vpn app (which i dont want to) it shows me all the servers and load on them so I can decide which one to use.
With strong swan, I loaded one server on...but whats the best way to figure if aerver i am using is optimal.
Also battery drain is better than using nordvpn app, but it seems to get stuck every few hours and I have to dusconnect and reconnect. Also if I turn alway on vpn on in android setting, it drains battery lot more.
vm81 said:
Thanks for your response. I was planning to use only one at a time ikev2 or openvpn. I juat installed both to see how they compare.
Anyways, one of my questions is that how do i select which server to use. If i use nord vpn app (which i dont want to) it shows me all the servers and load on them so I can decide which one to use.
With strong swan, I loaded one server on...but whats the best way to figure if aerver i am using is optimal.
Also battery drain is better than using nordvpn app, but it seems to get stuck every few hours and I have to dusconnect and reconnect. Also if I turn alway on vpn on in android setting, it drains battery lot more.
Click to expand...
Click to collapse
You've already answered your own question. Put as many servers as you want on Strongswan and use the Nordvpn app to decide which one to use.
I don't know what phone or android version you're using but both my phones are on Oreo and they don't have the always on option any longer. I just whitelist and enable autostart for Strongswan. It may get stuck but that generally depends on your vpn, mobile and wifi networks not Strongswan.
After my phone has been asleep for a while, when I wake it, the data doesn't work. Anyone else have this problem with strongswan? I've tried it using both windscribe and nord, same issue with both
johnjay06 said:
After my phone has been asleep for a while, when I wake it, the data doesn't work. Anyone else have this problem with strongswan? I've tried it using both windscribe and nord, same issue with both
Click to expand...
Click to collapse
Sounds like it has something to do with your phone settings. What phone do you use?
Twotems said:
Sounds like it has something to do with your phone settings. What phone do you use?
Click to expand...
Click to collapse
Galaxy s9. I've tried everything I know to
johnjay06 said:
Galaxy s9. I've tried everything I know to
Click to expand...
Click to collapse
I have the same issue on my Lenovo tablet running Marshmallow actually. It happens when it goes into deep doze and disables wifi. No such issues on Xiaomi, Huawei or Vivo phones as the settings are granular unlike the Lenovo tablet. Try disabling your sleep/doze mode if you can.
outlaw1985 said:
The reason for the discharge of your battery may not depend on the vpn you are using, maybe your battery is already very worn out if you have been using it for several years, or your vpn spends too much of your smartphone's resources and therefore it discharges very quickly ...
Click to expand...
Click to collapse
This thread is ancient. But to answer your question, Wireguard solved the problem.