Hello,
I need little help to make my own, first command in tasker app.
I currently use tasker with command "Turn Off Bluetooth If No Device Connected" [LINK TASKER].
Recently, I have been using the NFC module a lot for the purpose of identity verification (electronic ID card). I always forget to turn them off after using NFC. I think that the command I use for bluetooth may be the same to create a similar one for NFC. It would be great if I could do functions in one command, that NFC turns on when I use the application and turns off when not in use (or when I don't use the application).
I wouldn't like to get into trouble by creating a wrong command, so I'm asking You for help / verification of the command code itself.
Assumptions:
1. If I turn on the XYZ application -> turn on the NFC module.
2. If the NFC module isn't used -> turn off after XYZ minutes of inactivity // or // turn off if I turn off the XYZ applications (we can make two conditions running in parallel in one command?)
Today or tomorrow I will post what I wrote so far so that you can assess / check if there are mistakes
I think that there is it no built in variable for NFC activity.
you can trigger the NFC by Application profile. You may use the "services" button, to make sure that the exit condition will not run while the process is still running.
Related
Hi all,
1.
I have created an application to test my GPS module on my device.
It works well thus far. However, I wonder if there is any possibility can enable
the GPS module without manually.
Here is the scenario, when i execute the application installed on my android
phone, if my GPS is disabled, a dialog will pop up to request the user to enable
the GPS module. Then the screen will turn into the GPS setting option, the user
needs to enable the GPS module manually.
Is there any possibility to enable the GPS module automatically when I execute
my aps on android? I was trying to google it but all reply is this behavior
involves the security issue so that there is other way to do it.
2.
I have an application which can help me test the wifi connectivity.
Again, it works well.
However,is it possible to transfer a file or send data using something like netperf? It is valuable to test this as Tx can use more power and I want to make sure it is functioning well.
Any reply is highly expected.
Thanks all
Can someone please guide me a direction to go?
Any reply will be very appreciated.
It's been bugging me for a while that Wi-Fi Calling service eats a lot of battery even if actual calling with WiFi is disabled. You can see the process always running and using CPU with programs like OS Monitor and alike. I did not want to uninstall the app completely as I think I may use it some time when there is no cell signal available, but I definitely don't use it on everyday basis. So I finally found a way to enable/disable the service on demand. Disabling it really does improve battery life. Warning: the phone must be rooted.
The simplest way to do it is to write some simple scripts and then use Script Manager app (free in the Market). Write two scripts like this:
#!/bin/sh
pm enable com.android.kineto
and
#!/bin/sh
pm disable com.android.kineto
Save them as files with extension .sh anywhere you like. Make sure you use Unix format for line ends (LF only.) Then open the scripts in Script Manager making sure Run as Root is checked, and run them when you need to enable or disable WiFi calling.
The easiest way that I have found is to use Titanium backup and just "freeze" wifi calling, then if you find yourself needing to use it you can open TB back up and un-freeze it.
Works great for me. I freeze anything that I don't use, as I am not as concerned with space. Also, deleting some apps can cause system problems. Where as, if you freeze them everything else stays in-tact. Then I still have the bloat there if I ever did want it.
Didn't realize that Titanium Backup has a Freeze option! It looks like it does the same because after running the pm disable com.android.kineto the WiFi Calling is shown as frozen in TB.
I went with Script Manager because I already run some scripts on the phone such as setting install locations to SD/internal memory.
I used Titanium Backup and it screwed up my market links after I flashed T959VUVKC1 rom and went to TB, links all dissapperead on the market
nakawzl said:
I used Titanium Backup and it screwed up my market links after I flashed T959VUVKC1 rom and went to TB, links all dissapperead on the market
Click to expand...
Click to collapse
What links on the market are you talking about?
Sent from my SGH-T959V using XDA Premium App
AntonX said:
The simplest way to do it is to write some simple scripts and then use Script Manager app (free in the Market). Write two scripts like this:
#!/bin/sh
pm enable com.android.kineto
and
#!/bin/sh
pm disable com.android.kineto
Save them as files with extension .sh anywhere you like. Make sure you use Unix format for line ends (LF only.) Then open the scripts in Script Manager making sure Run as Root is checked, and run them when you need to enable or disable WiFi calling.
Click to expand...
Click to collapse
Any way to do this from Tasker?
Ahh, looks like it can be done but I'm doing some testing and may give some steps.... having it running all the time is just bones crazy.
EDIT:
Okay, Got it done with Tasker... I haven't got it automated yet, not sure if I want to - it looks like a lot more work, and I'm also not sure if I want it always on when I'm on my wifi...
You also need the Locale Execute plugin.
This method will give tasks that can be hooked into widgets:
Create a Task "Disable Wifi Calling"
1: IF %WIFII ~ *CONNECTED*
2: Variable Set %WIFIWASON To YES
3: End If
4: Wifi Set Off
5: Wait 5 Seconds
6: Plugin:Execute @!pm disable com.android.kineto
7: If %WIFIWASON ~ YES
8: WiFi Set On
9: Variable Clear %WIFIWASON
Create a Task: "Enable Wifi Calling"
1. WiFi Set On
2. Plugin:Execute @!pm enable com.android.kineto
3. Wait 5 Seconds
4. Load App Wifi Calling
What is going on:
Disable script will check if wifi is on at the time it is executed. It has to turn Wifi OFF so we get a clean disconnect from the network and the taskbar Icon goes away before killing the Wifi Calling app. If Wifi was on beforehand, it turns it back on.
Enable script will make sure wifi is enabled, and give it time to connect, and then load the application since sometimes it won't activate on its own without loading manually.
These tasks are intended to be linked to Tasker widgets on your homescreen, but you can call them from location based profiles or whatever.
noob here, created scripts looks to be working, am going to reset battery stats and double check but looks GREAT!! Thanks!!
Suggestions or questions are welcome!
Description:
Here is a simple-ish script I wrote to manage data flow on my phone. Mobile data on/off is easy enough but what most users have a hard time pulling off is when to toggle wifi on and off with minimal consumption. Using local tower states is pretty common but it's inaccurate and slow; additionally my method uses less battery life.
Room for improvement:
The only thing I would like to do in order to improve this is to have the script not disable data when downloading or streaming. This is possible but is unique per device per ROM so I can't really go into detail about how to do it. As a summary though there's a file that is written to that keeps information about bytes traffic. You just read this file to determine how much data is flowing in a specific interval and if it exceeds a certain amount then don't turn off data just yet. It's also a known issue where with some devices the 3G state change won't register when toggling manually while connected to wifi.
Features:
Wifi and 3G will disable two minutes after the screen is off so it's not constantly toggled through intermittent use.
On some phones or providers the 3G status becomes unknown when in a call or when connected to wifi; this script works around that.
Unlike most data management apps this one will remember your 3G status should you manually change it, in case you don't want 3G on at all.
Data is still checked on an hourly basis(this can be adjusted of course).
Fast and accurate wifi connecting with very minimal power drain.
Just a few things explained for those curious:
I check the phone state to ensure that 3G isn't detected as manually disabled when your provider uses 3G to place calls.
I check the screen on time because on some phones/ROMs the 3G doesn't actually register as toggled until the screen flickers back on. Because of this 3G appears to only become disabled once the screen turns back on and it can be registered as manually turning it off.
The wifi timer exist so the script won't check for a wifi too frequently.
You can adjust the hourly checks under Cycle 3G.
What version of Tasker is this developed under? Just curious, I'm running the 4.0 beta, and I just had to back out of b19 to b18 because of issues with my data management profile. I'll try yours out, it sounds a lot better than mine...
Can't seem to get this to work...tasker wont recognize the file
Sent from my SAMSUNG-SGH-I727 using Tapatalk 2
It's working great for me on 4.0b18. I still need to look at the logic being used as to what causes it to 'wake up' and connect to wireless, is it simply a delay after screen on, or are you also looking at other factors?
Tasker 1.3.3u2
My friend had problems getting his to recognize the profile as well. I'm not sure why.. It might have to be in the proper directory. You might also have to make a new profile tab for it. Hopefully rpr69 can give us some insight.
But to answer your question as to how I check Wifi...
When screen turns on I immediately try to connect to Wifi before trying 3g. 3g will still enable briefly after for phones that require it for MMS. If Wifi isn't connected after X seconds then it disables Wifi and won't try again for 10 minutes. If it does connect successfully there will be no 10 minute wait next screen on.
Added manual toggle memory to Wifi as well. I'll post the changes later and update the zip file.
Are you importing the profile, or just dropping it in a directory? The proper way is to import into a new project. In 1.3 of Tasker (from memory, it's been awhile), you need to pull down from the top of the Tasker top bar which should then give you the Projects tabs. Long press on the Home tab, and you should get an 'import' option, navigate to where you downloaded the project file on your phone and select it, and it should create a new tab for it, with the profile and tasks under it. If you had previously just manually copied the xml file into the projects directory, move it out of there or the import may fail.
Looking forward to the update!
Ok got it to work I forgot is was a project and kept trying to import only a profile. It seems great so far!!!
Sent from my SAMSUNG-SGH-I727 using Tapatalk 2
To make it so it won't check wifi when you don't want it to add the following...
ProfileName - Record Wifi State
Trigger - State > Wifi Connected *
Enter Task - Set Variable %wifistate to 1 if screen ~ on
Exit Task - STOP If %ScreenOnTime + 2 > %UPS
......Set Variable %wifistate to 0 if screen ~ on
then under task "Data Types On - Type 2 P2"
very first line add - If Then > %wifistate = 1
Place a closing End If at the very bottom, and move the "Mobile Data > Set On (if %3GState = 1)" second from the bottom, just above closing.
I also just uploaded the xml file again to the main post.
My purpose is to make sure that if someone steals my phone, they can't turn off both wifi and location accessibility. So that I can find it and trace the phone. Because you know, a lot of techies and apps tell us that you can find your phone if it is connected to the internet and its location is turned on. Now, all needed to do on the part of the thief is to turn off the wifi and location. Is there any way we can turn on wifi and location in android secretly and only the owner of the phone has the access to turn them off? My phone is Samsung Galaxy Note 2. Thank you so much in advance.
Hmm, since the android os is very much similar to the linux os, I'd make a script that enables wifi even when you switch it off. Ie: You switch off wifi, the script switches it back on. Now, the key thing here is that android is similar to linux, and that means we can run sh scripts, right? But the only issue I see is that we will have to somewhat make the script run in the background all the time, or make an "if" statement that says "if wifi is off, switch it back on" or something similar, but I can't do that. Instead, I will be guiding you to make the .sh script.
First of all, get the idea of how the wifi works, what files it uses and what stages happen when you connect to a wifi, which you can check out here.
Then, based on that, start scripting the .sh file. Guides on how to do this, can be checked out by a quick google.
Alternative: Ask someone on stackoverflow or something similar to do it for ya hehe
Try to use some tasker like MacroDroid and setup trigger to disable wifi and action to enable wifi, same with GPS... And disable tasker notification from notification bar.
dns43 said:
Try to use some tasker like MacroDroid and setup trigger to disable wifi and action to enable wifi, same with GPS... And disable tasker notification from notification bar.
Click to expand...
Click to collapse
Thank you so much, seems simple to implement....
Hizzur's Answer
i don't know. sorry!
Has anyone been able to get any program to automatically enable hotspot (for example, when bluetooth connects turn on hotspot)? I used to use Tasker on my Note 7 (without root and with Secure Settings), but now Tasker fails to enable hotspot on my S8+
Every program I've tried in the Play Store fails to enable hotspot...it is like Samsung has done something that to keep programs such as Tasker and Automate from working...
It fails because the US branded versions of the phone changed the normal way to enable the hotspot function in order to perform additional entitlement checks with some US carriers before enabling the hotspot. This is why Tasker and other programs fail.
On the unlocked, unbranded version of the S8+ (which doesn't run the carrier software and doesn't run those checks), it works fine.
The same goes to the pixel, only there it depends on the SIM you insert into the phone. If you insert a VZW or ATT SIM, the Tasker process will fail. If you use a T-Mobile SIM in the pixel, it will work because T-Mobile doesn't run those entitlement checks.
When I used an international SIM in the Pixel, it also worked.
I hope this helps.
This is the error I get with tasker, is this what you see?
Ugh...I figured it was something to do with that. That's like knowing cancer is the cause of that pain in your gut...good to know what it is, still sux.
I have been able to get Tasker and AutoInput to activate the hotspot fairly reliably when I connect to bluetooth. It actually works very well, even with the screen off. Guess it'll do.
Care to explain what you are doing there? Is autoinput disabling mobile data, enabling hotspot then re-enabling mobile data?
Auto Enable Hotspot with Tasker on S-8
I got the automatic hotspot worked out using Tasker and AutoInput. I tried several ways that were hit or miss. I finally figured it out and can now activate my Hotspot reliably when my phone connects to bluetooth.
If anyone is interested, here is the export. You will need AutoInput from the Play store, and Tasker. Root is not necessary. It is probably a pretty clumsy way of doing it, but it works.
Simply copy the Hotspot Enable XML file to your Tasker Configs folder. Then Tasker>>3-dot menu>>Data>>Restore>>browse to file
Thanks I'll try this. I always used tasker before but obviously w/o Autoinput.
Dave
No dice for me. Aside from autoinput and tasker did you have to install anything else? I did enable the autoinput accessibility service. I've included screenshots of what I get when I try to run the task and also when I click on any one line of the task. When I click to install what it says to it says it is just takes me to auto input in playstore which is already installed. Is there somewhere else I need to enable this auto input plugin?
It also seems I had to install secure settings which I did to no avail.
Thanks much
Dave
TT_Vert said:
No dice for me. Aside from autoinput and tasker did you have to install anything else? I did enable the autoinput accessibility service. I've included screenshots of what I get when I try to run the task and also when I click on any one line of the task. When I click to install what it says to it says it is just takes me to auto input in playstore which is already installed. Is there somewhere else I need to enable this auto input plugin?
It also seems I had to install secure settings which I did to no avail.
Thanks much
Dave
Click to expand...
Click to collapse
Sorry Dave, I haven't been back on.
It looks like you need to install "Secure Settings" from the play store. It is an add-on to Tasker. It should work after that.
So yes, you need Tasker, Secure Settings, and AutoInput. You could honestly probably do without the first command in Tasker (the one that needs Secure Settings...it only turns the screen on).
I tried again removing that first line and every single action if I click on it I get the error in the picture below. I try to manually run it in tasker it just sits at the first task. How did you create this exactly?
Btw, if I click to install it just brings me to autoinput I the play store which says it's installed.
Any help pinetreehater?
Well i ended up having my phone die and got a new one from samsung. Same issue I had w/ the other one. There has to be some other step involved that I'm missing here.
Any luck yet?
Sort of working
I downloaded and paid for AutoInput. The script is mostly working. But it stops at the Hotspot setting screen and never seems to turn it on.
Any ideas?
Apologies for necroposting, but I thought this might help future people. The only issue I can think is that you need to make sure you've activated Autoinput's trial period OR purchased the full version, do that and the supplied script works perfectly.
so I'm using the s9, figured the process would be close enough. first Trigonous' fix worked for me mostly, except I still have to unlock my phone before it finishes turning on hotspot. Also, for any totally novice users coming in to try to do this, I had a fun time at first locating the Tasker Configs file, if you create a back up in tasker it will create the file for you so you can copy the .xml to the proper place.
Most important part of this post, to me at least, is there a way to get it to by pass my unlock and just do it or do I have to pull out my phone still and unlock it for it to finish the task?
snaggle2thtiger said:
Most important part of this post, to me at least, is there a way to get it to by pass my unlock and just do it or do I have to pull out my phone still and unlock it for it to finish the task?
Click to expand...
Click to collapse
I'm no expert, but why not set your cars Bluetooth as a trusted device, therefore unlocking your phone when connected, then maybe a brief delay after connection allow it to continue?
Thank you
pinetreehater said:
I got the automatic hotspot worked out using Tasker and AutoInput. I tried several ways that were hit or miss. I finally figured it out and can now activate my Hotspot reliably when my phone connects to bluetooth.
If anyone is interested, here is the export. You will need AutoInput from the Play store, and Tasker. Root is not necessary. It is probably a pretty clumsy way of doing it, but it works.
Simply copy the Hotspot Enable XML file to your Tasker Configs folder. Then Tasker>>3-dot menu>>Data>>Restore>>browse to file
Click to expand...
Click to collapse
Thanks man, saved me some time, it works perfectly. I installed AutoInput and was moving in the same direction.