Programatically GPS - General Questions and Answers

Hi all,
How to switch on GPS programatically.
Thanks & Regards,
Dinesh

You can't do that other way than opening GPS settings. Security concerns.

Use SwitchPro widget, Luke

Thanks for your reply

o4kareg said:
Use SwitchPro widget, Luke
Click to expand...
Click to collapse
Hmm, are you sure it really enable/disable GPS directly? As I said I believe this isn't possible without some hacking, root access, etc. Just tried "GPS on/off" widget from the Market (because SwitchPro is paid app) and it does exactly what I said: it opens locations settings.

ok thanks for your reply.

I can Enable/Disable GPS directly. but i can't Enable/Disable GPS programatically.

dineshsubramanian said:
I can Enable/Disable GPS directly.
Click to expand...
Click to collapse
Using that SwitchPro widget?

Brut.all said:
Hmm, are you sure it really enable/disable GPS directly? As I said I believe this isn't possible without some hacking, root access, etc. Just tried "GPS on/off" widget from the Market (because SwitchPro is paid app) and it does exactly what I said: it opens locations settings.
Click to expand...
Click to collapse
I am sure, becaus I'm using this widget. Older versions just opened GPS settings, but latest one v1.6 turns GPS on/off directly.

o4kareg said:
I am sure, becaus I'm using this widget. Older versions just opened GPS settings, but latest one v1.6 turns GPS on/off directly.
Click to expand...
Click to collapse
Yes it does, doesn't appear to be using root either. It's possible it could be using an exploit though?

o4kareg said:
I am sure, becaus I'm using this widget. Older versions just opened GPS settings, but latest one v1.6 turns GPS on/off directly.
Click to expand...
Click to collapse
Maybe it requires root? Or some custom ROM? Unfortunately it's paid app and I won't pay for it just to check, how it works. I don't think it uses "clean" way to accomplish that.

Ok, it uses Power Control widget to set GPS status. This widget is a system app, so it has superpowers (can enable/disable GPS directly) and SwitchPro let him think, that someone has clicked on GPS button.
Of course this widget isn't in official Android API, it isn't integral part of Android system, so this may not work on some devices, some ROMs, may also break totally in the future. You could use same technique, but you shouldn't.
EDIT:
Ahh and seems this widget is a huge security hole. This should be fixed, I will create an issue in Android issue tracker, if there isn't one.

Brut.all said:
Ahh and seems this widget is a huge security hole. This should be fixed, I will create an issue in Android issue tracker, if there isn't one.
Click to expand...
Click to collapse
Ok, this is already in their issue tracker:
http://code.google.com/p/android/issues/detail?id=7890

Thought as much, the dev should really go back to the 'official' way IMO.

Is there still a way to do this ? Because on the issue tracker page they said it was already "fixed" (that means broken to me ).
I need to set auto turn on for GPS on a given time. Is that possible ?

grandioso said:
I need to set auto turn on for GPS on a given time. Is that possible ?
Click to expand...
Click to collapse
No. It's a feature, not a bug.

Feature of what ? Do you mean the android power management widget ?
If it's a feature, than it should still be possible to turn on GPS through it.

grandioso said:
Feature of what ? Do you mean the android power management widget ?
If it's a feature, than it should still be possible to turn on GPS through it.
Click to expand...
Click to collapse
It's safety concern. Google didn't give you a possibility to switch GPS purposely and only one reason, why you could do it, was that they made some security hole. Now they have fixed it, so you won't be able to switch GPS - at least without another bug ;-)

Hi androiest
How can google map start gps without going throught the settings activity ??

Related

Tasker Question

Can someone please walk me through enabling GPS on Tasker and Secure settings? I;'d like to do the Auto GPS toggling but it keeps telling me that Google locked? GPS since version 2.1? Help!!
Use titanium backup to make Tasker a system app, then it will be able to toggle gps
Sent from my HTC One XL using xda premium
Did that and it still doesn't work. Any other ideas?
gpo1956 said:
Did that and it still doesn't work. Any other ideas?
Click to expand...
Click to collapse
Sorry. I didn't actually test it when I answered your question...I know that for the Notification Toggles app, making it a system app will allow it to toggle your GPS. It seems that Tasker has a built in popup that doesn't allow GPS to be set based on your version of Android, as in it doesn't even let you attempt to see if it works. The popup does suggest downloading the "Secure Settings" plugin, link below. I have no experience with it but based on the reviews it seems to work.
https://play.google.com/store/apps/...pYmxlb2JqZWN0LnNlY3VyZXNldHRpbmdzLnBsdWdpbiJd
Edit: Just tested out Secure Settings and yeah, it works. Just download the helper app from within Secure Settings and you're good to go.
Thanks. I kept trying and trying to enable GPS and finally it let me do it. I'm rolling now!

Lock screen off when connected to Smartwatch - how?

Hi, I would like to have lock screen disabled when I'm connected to my Smartwatch 2, and as soon as the connection is broken - I want the lock screen back on. I guess it's possible to do it with Tasker, but I have no idea how. Any help?
I do this with my work Wi-Fi network... So I assume the same rule applies, instead of connected to X WiFi network, you set it up as connected to X Bluetooth.
I use Tasker and Secure Settings to get this to work.
hurdlejade said:
Hi, I would like to have lock screen disabled when I'm connected to my Smartwatch 2, and as soon as the connection is broken - I want the lock screen back on. I guess it's possible to do it with Tasker, but I have no idea how. Any help?
Click to expand...
Click to collapse
Attached my tasker implementation.
As I have both Samsung Galaxy Gear and Sony Smartwatch 2, my profiles check for both connections.
Under the
Bluetooth Connected profile *, B4:52:7D:F3:A6:A6​Not Bluetooth Connected profile *, B4:52:7D:F3:A6:A6​
you will need to change to make it work with your smart watch as that is my Sony Smartwatch 2 bluetooth address.
The lockscreen password is cfchong. To modify it to your own, you have to go through all the tasks and change them at the Set Password to your preferred password.
You will also need to set the lockscreen security to none in the Phone Settings (not tasker). I set my lockscreen security to swipe as without the lockscreen, the phone may be woken accidentally in the pocket and the homescreen widgets been activated.
I have also included some profiles to set the phone silent mode to on/off when connected/disconnected except when a call is in progress.
[Edit]
Oh...what I would die for now...is to get a WeChat smart extension. I have 10 times more WeChat messages than WhatsApp :waiting...waiting:
thanks, but it seems i can't import it to tasker. it says failed to move to SD. any ideas?
second, how do i find out the smartwatch BT address? it's not in smartconnect and not in bluetooth settings.
hurdlejade said:
thanks, but it seems i can't import it to tasker. it says failed to move to SD. any ideas?
second, how do i find out the smartwatch BT address? it's not in smartconnect and not in bluetooth settings.
Click to expand...
Click to collapse
unzip the file and move the SmartWatch.prj.xml file to the projects subfolder of tasker.
select the bluetooth address using the search button in tasker as showed in attached screenshot. it should show all your bluetooth paired devices.
as i am still in the process of enhancing my profiles, attached is my latest "enhanced" profiles.
feel free to modify at your heart's content.
cfchong said:
unzip the file and move the SmartWatch.prj.xml file to the projects subfolder of tasker.
select the bluetooth address using the search button in tasker as showed in attached screenshot. it should show all your bluetooth paired devices.
as i am still in the process of enhancing my profiles, attached is my latest "enhanced" profiles.
feel free to modify at your heart's content.
Click to expand...
Click to collapse
Hi cfchong
Thank very much your project template. I imported it to tasker, and it reports right state of SW connection. But my phone isn't locked with PIN/Password when SW disconnected. Could you instruct me more.
thanks
Awesome!
Sent from my GT-I9300
still doesn't work with me, Anyone help.
My Xperia Z1 with Android 4.4 .575
thanks
xuandai said:
still doesn't work with me, Anyone help.
My Xperia Z1 with Android 4.4 .575
thanks
Click to expand...
Click to collapse
Hi, I've made my own and its simplified so its only for the Smartwatch without all the variables and complicated stuffs... I have attached it to this post.
Firstly set the password on your phone to none... then...
Make sure you have disabled beginners mode in tasker and you have installed secure settings from the play store...
Then tap the home icon and tap import and then navigate to the file you extracted from the zip...
Then edit the states under profiles to use your smartwatches bluetooth address by removing mine and clicking the search icon...
go to the tasks tab and open the SW2NotConnected task and set pin and then click the pencil
enable device admin and change the pin code...
click save and navigate back using the onscreen controls...
Try it and see if it works I hope it works
danster3 said:
Hi, I've made my own and its simplified so its only for the Smartwatch without all the variables and complicated stuffs... I have attached it to this post.
Firstly set the password on your phone to none... then...
Make sure you have disabled beginners mode in tasker and you have installed secure settings from the play store...
Then tap the home icon and tap import and then navigate to the file you extracted from the zip...
Then edit the states under profiles to use your smartwatches bluetooth address by removing mine and clicking the search icon...
go to the tasks tab and open the SW2NotConnected task and set pin and then click the pencil
enable device admin and change the pin code...
click save and navigate back using the onscreen controls...
Try it and see if it works I hope it works
Click to expand...
Click to collapse
Thank very much your support. I still doesn't work for my Z1, I think there is problem in my "secure setting" software, It coudn't set PIN/password in my phone. I don't know why, it was rooted.
xuandai said:
still doesn't work with me, Anyone help.
My Xperia Z1 with Android 4.4 .575
thanks
Click to expand...
Click to collapse
xuandai said:
Thank very much your support. I still doesn't work for my Z1, I think there is problem in my "secure setting" software, It coudn't set PIN/password in my phone. I don't know why, it was rooted.
Click to expand...
Click to collapse
Are you sure you have device admin enabled
danster3 said:
Are you sure you have device admin enabled
Click to expand...
Click to collapse
Yes, it's.
When I used project from cfong, it enable silen mode, but didn't put PIN/password
There is also a simple app just for this purpose. Autolockphone.. It's in pay store.
Sent from my HTCONE using XDA Premium 4 mobile app
xuandai said:
Yes, it's.
When I used project from cfong, it enable silen mode, but didn't put PIN/password
Click to expand...
Click to collapse
Have you tried just creating a new task and using secure settings to set a pin without any profiles, try and mess around with that.
Sent from my GT-I9300
danster3 said:
Have you tried just creating a new task and using secure settings to set a pin without any profiles, try and mess around with that.
Sent from my GT-I9300
Click to expand...
Click to collapse
I ttried many time with simple task as: set pin, NFC, airplane, but none of them workd.
xuandai said:
I ttried many time with simple task as: set pin, NFC, airplane, but none of them workd.
Click to expand...
Click to collapse
are you rooted?
danster3 said:
are you rooted?
Click to expand...
Click to collapse
^ This
1. You have to be rooted
2. You have to grant Secure Settings admin access in your device settings.
3. Make sure to enable System+ module in Secure Settings Plugin.
4. Run 2 simple actions that require root privileges (1 for Tasker and 1 for Secure Settings), while the screen is on and make sure you grant the 2 apps Superuser permissions.
Sorry to bump a 2 week old thread, but it appears as though some are still having problems. I don't use a pin lock, but I routinely disable the keyguard while connected to my Motorola Roadster 2 in the car. For those who are experimenting with Tasker for the first time, keep it simple for now. Too many task / profile collisions can really mess with what you're trying to achieve. Hope this helps.
htcslic said:
There is also a simple app just for this purpose. Autolockphone.. It's in pay store.
Sent from my HTCONE using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Agree, absolutely hassle free and worth the money.
I'd recommend this https://play.google.com/store/apps/details?id=com.benhirashima.skiplock
Sent from my D5503 using XDA Free mobile app

[REQ] Mobile Data working

Hej,
I´ve used in the past power toggles to set on/off the mobile date, when I go home/come home.
Now, under 5.0 it´s not working anymore - do you have any solution for that?
Or another app, where I can set a widget and easy put the mobile date on/off?
Thanks!
Same here. I have to manually enable/disable mobile data... I hope someone brings back quick swipe to quicksettings.
Rashiel said:
Hej,
I´ve used in the past power toggles to set on/off the mobile date, when I go home/come home.
Now, under 5.0 it´s not working anymore - do you have any solution for that?
Or another app, where I can set a widget and easy put the mobile date on/off?
Thanks!
Click to expand...
Click to collapse
It's there! Click on the mobile network toggle, then there's a switch top right.
krs360 said:
It's there! Click on the mobile network toggle, then there's a switch top right.
Click to expand...
Click to collapse
Hej,
give me please screenshots, so I know I´m the person who´s not correct.
At my place - I can´t switch via widget the mobile data on/off.
Rashiel said:
Hej,
give me please screenshots, so I know I´m the person who´s not correct.
At my place - I can´t switch via widget the mobile data on/off.
Click to expand...
Click to collapse
Attached.
Edit: Just re-read your original post, sorry I thought you meant on the quick toggles.
I don't see why you would bother using a widget for it though when it's right there.
krs360 said:
Attached.
Click to expand...
Click to collapse
Ok - that´s cool.
BUT is it possible to get access from a widget from screen?
Or is it possible to change the order of the symbols?
I'm glad that I ain't the only one with this problem lol
So they changed something that doesn't allow apps to make this work
The thing is, without power toggles working or changing the order from the buttons in system, it´s really, really incommodious...
Rashiel said:
The thing is, without power toggles working or changing the order from the buttons in system, it´s really, really incommodious...
Click to expand...
Click to collapse
Just saw this: http://www.xda-developers.com/andro...gn=Feed:+xda-developers/ShsH+(xda-developers)

Location icon constantly in status bar on Lollipop ?

Is it normal for the GPS status icon to always be present in the right side of the status bar on Lollipop (V5.02)?
Location is enabled and is set to high accuracy. No apps are running (or present in the recent apps list) that make constant use of the GPS (IE: Maps).
I'm curious if this is normal behavior on this device. I have 3 other devices to compare to that have the same apps and location settings :
- Galaxy S3 -- Icon is always present when location is enabled (Android 4.4)
- Nexus 5 -- Icon only appears when an app requests use of the GPS (Android 5.1.1)
- Nexus 9 -- Icon only appears when an app requests use of the GPS (Android 5.1.1)
the.teejster said:
Is it normal for the GPS status icon to always be present in the right side of the status bar ?
Location is enabled and is set to high accuracy. No apps are running (or present in the recent apps list) that make constant use of the GPS (IE: Maps).
I'm curious if this is normal behavior on this device. I have 3 other devices to compare to that have the same apps and location settings :
- Galaxy S3 -- Icon is always present when location is enabled (Android 4.4)
- Nexus 5 -- Icon only appears when an app requests use of the GPS (Android 5.1.1)
- Nexus 9 -- Icon only appears when an app requests use of the GPS (Android 5.1.1)
Click to expand...
Click to collapse
It does not turn off automatically unless you are running an app to do so. My battery saver app lets you specify a list of apps that need gps...when I run the app it turns on gps...when the app exits it turns gps off. There is also a free version of it..search for "Greeenpower"...it does require root for an app to toggle gps under lollipop.
Thanks for the reply but I didn't think that applied to Android V4.x and UP.
You are supposed to be able to keep your location toggle set on ON all the time and Android is supposed to only enable it when an app requests it.. I can clearly see this behaviour on both my Nexus devices running lollipop.
Since this phone is as close to stock android as I've ever seen I'm wondering if anyone else is observing the same behaviour I am or if else might be keeping it forced on unknowingly.
famewolf said:
It does not turn off automatically unless you are running an app to do so. My battery saver app lets you specify a list of apps that need gps...when I run the app it turns on gps...when the app exits it turns gps off. There is also a free version of it..search for "Greeenpower"...it does require root for an app to toggle gps under lollipop.
Click to expand...
Click to collapse
the.teejster said:
Thanks for the reply but I didn't think that applied to Android V4.x and UP.
You are supposed to be able to keep your location toggle set on ON all the time and Android is supposed to only enable it when an app requests it.. I can clearly see this behaviour on both my Nexus devices running lollipop.
Since this phone is as close to stock android as I've ever seen I'm wondering if anyone else is observing the same behaviour I am or if else might be keeping it forced on unknowingly.
Click to expand...
Click to collapse
Mine is also constantly on.
Macklessdaddy said:
Mine is also constantly on.
Click to expand...
Click to collapse
Mine is constantly on, like now.
the.teejster said:
Thanks for the reply but I didn't think that applied to Android V4.x and UP.
You are supposed to be able to keep your location toggle set on ON all the time and Android is supposed to only enable it when an app requests it.. I can clearly see this behaviour on both my Nexus devices running lollipop.
Since this phone is as close to stock android as I've ever seen I'm wondering if anyone else is observing the same behaviour I am or if else might be keeping it forced on unknowingly.
Click to expand...
Click to collapse
Well no offense but yours must be magic then cause I own both a nexus 4 and 5 and the gps doesn't turn off unless you or an app turns it off...same with bluetooth and wifi for that matter.
famewolf said:
Well no offense but yours must be magic then cause I own both a nexus 4 and 5 and the gps doesn't turn off unless you or an app turns it off...same with bluetooth and wifi for that matter.
Click to expand...
Click to collapse
I don't think he means it turns off in the settings. But the location active icon in the status bar only comes on when an app is actively using it. My nexus 4 does this. The idol the icon is always there.
IMO, its probably just a software GUI change that Alcatel did. Unless it is draining the battery more than usual.
Non taken .. LOL..
Bluetooth and Wifi, when on do constantly show up on my nexus devices..
Location icon however, on stock lollipop will only appear when the GPS actually is in use. IE: It will appear when I load up google maps and disappear when I turn it off (on stock 5.1.1 on nexus 5 and 9).
I thought this was a feature baked into lollipop which is why I was asking. But from I'm hearing it's not.
Thanks everyone for taking the time to reply.. much appreciated.
BTW:
Looks like it's default behavior on at least one other device:
http://talk.sonymobile.com/t5/Xperi...t-appear-in-statusbar-on-lollipop/td-p/975946
Location
famewolf said:
Well no offense but yours must be magic then cause I own both a nexus 4 and 5 and the gps doesn't turn off unless you or an app turns it off...same with bluetooth and wifi for that matter.
Click to expand...
Click to collapse
Maybe there is a secret Chinese system app that is continually tracking you with location? Haha
I was concerned about this too, and looked into it, I can 100% confirm that it's a software change. On the stock Idol 3 ROM, the location icon in the task bar merely shows that location is on, NOT THAT GPS is active.
If you're skeptical, download a GPS monitor app (some available without root, better ones available with root). You can confirm for yourself that the GPS monitor pings each and every time you use a location-based app (map, weather, etc), but not otherwise, even though the location icon is on.
It's constantly on for my Idol 3, but not my Moto X with CM 12.1.
A fix for this problem, if you have Xposed installed:
http://repo.xposed.info/module/com.xinlu.location_icon_fix
polygonal said:
A fix for this problem, if you have Xposed installed:
http://repo.xposed.info/module/com.xinlu.location_icon_fix
Click to expand...
Click to collapse
Very nice! Thanks for creating the module! Out of curiosity do you get the popup every time you install an app or module to select whether to install to internal, external or let the system decide?
famewolf said:
Very nice! Thanks for creating the module! Out of curiosity do you get the popup every time you install an app or module to select whether to install to internal, external or let the system decide?
Click to expand...
Click to collapse
Yes, I do. If I remember correctly, this started to happen around the time of the last update from Alcatel?
polygonal said:
Yes, I do. If I remember correctly, this started to happen around the time of the last update from Alcatel?
Click to expand...
Click to collapse
Thanks for the reply. Nice to know it's not just MY phone. On my 6045i it's been happening quite a while if not from the beginning but it's very annoying as I have not yet found a way to disable it. Even running "pm set-install-location" from a shell doesn't stop the popup. Normally the setting would be under settings, apps or settings, storage but doesn't appear to be.
I'd compare this to some manufacturers adding an NFC icon. They think the user wants to know (all the time) if a setting is on or off.
the icon appears for me always; even after I turn location OFF in the settings...
so is it a bug or is it on purpose?
i've noticed if you turn off the location and then back on, the icon doesn't show up until something does request location, but then after that the icon stays there forever
ps. i'm glad i found this thread i thought i was going crazy
Thanks for the module.
**TheDuke** said:
I was concerned about this too, and looked into it, I can 100% confirm that it's a software change. On the stock Idol 3 ROM, the location icon in the task bar merely shows that location is on, NOT THAT GPS is active.
If you're skeptical, download a GPS monitor app (some available without root, better ones available with root). You can confirm for yourself that the GPS monitor pings each and every time you use a location-based app (map, weather, etc), but not otherwise, even though the location icon is on.
Click to expand...
Click to collapse
Please, could you suggest an app for GPS monitoring? I'm on a Xperia M4 Aqua Android 5.0.2 and facing the same problem. It's driving me crazy...

Marshmallow Bug

Hi everyone,
can someone confirm if they are also experiencing the overlapping of small apps and navigation menu?
boyaxnxtdoor said:
Hi everyone,
can someone confirm if they are also experiencing the overlapping of small apps and navigation menu?
Click to expand...
Click to collapse
Yep the same
Do you guys have developer option enabled?
I don't thing its a bug !
Small app toolbar disappears when scrolling
Alaa | Google Android said:
I don't thing its a bug !
Small app toolbar disappears when scrolling
Click to expand...
Click to collapse
Australian generic ROM looks like your left picture for my small apps, and swiping does the same swipe down small apps gone, swipe back up they appear again
I already figured it out and its a bug when you use an app that is related in "Accessibility". I am using Greenify and instead of using Google Now on tap, when I long press it, I want my screen to lock, then after I enable it, the overlapping will appear, and when I disable it , it will return to original position
Happens with me too when I use "lastpass". Turn off the accessibility option for Lastpass, and it fixes it. I think it would be considered a bug for the build.
Dockyy said:
Yep the same
Click to expand...
Click to collapse
Hello,
Yes after an upgrade. Gone after a clean install
gimmetaffy said:
Happens with me too when I use "lastpass". Turn off the accessibility option for Lastpass, and it fixes it. I think it would be considered a bug for the build.
Click to expand...
Click to collapse
Thanks for that had the truekey accessibility option ticked it's definitely the cause
Sent from my E6653 using Tapatalk
boyaxnxtdoor said:
I already figured it out and its a bug when you use an app that is related in "Accessibility". I am using Greenify and instead of using Google Now on tap, when I long press it, I want my screen to lock, then after I enable it, the overlapping will appear, and when I disable it , it will return to original position
Click to expand...
Click to collapse
many thank you very much, please save me,
to make a factory reset, thanks again
zippy01 said:
Thanks for that had the truekey accessibility option ticked it's definitely the cause
Sent from my E6653 using Tapatalk
Click to expand...
Click to collapse
Yes that worked. But then Pebble Time won't work. I do use the small apps quite a lot. Eghhh?
t is definitely caused by the accessibility service for Geeenify or any other system optimizing apps for me also. Disabling the accessibility service for them will solve the problem .... i tried it worked out !!
I can suggest that the overlapping problem comes also with tasker when the accessibility service is activated. Disabling the tasker service can resolve the problem but it sacrifices some importatnt tasker fontions. I tryed factory reinstallation but it can't resolve this issue. I have also grenify installed on my xperia z5. There is the same problem with microapps. Really disappointed with this update. The fingerprint funtionalyty is changed also, when you lock your phone with the external program like tasker you can't activate the phone with your fingerprint sensor, the phone asks for a password.

Categories

Resources