Hallo there,
Since I am quite new to Android, Tasker and everything that comes with it, I am constantly trying out new things, but there just some things I can't quite figure out.
My goal is to set any specific hardware button on my PX5 BMW E39 headunit (vor example the buttons 1 to 6) to launch a specific Tasker task.
I planned on using MTCD tools to send an order to Tasker to start task ABCXYZ.
I am planning to do so because I can't bring Tasker to use the "input keyevent xxx" action, MTCD works just fine for me.
How are Tasker task handled within android? Are they handled like an intent, an activity or a service?
If yes, how do I figure out which?
Put simple: I want to say to MTCD "when I press key 283, launch this task"
I especially want MTCD to do that, not tasker by using shell command "input keyevent xxx"
Thanks in advance.
Related
Good afternoon ladies & gents,
I've just bought myself some NFC tags and, along with the free app 'NFC Task Launcher', have managed to get my NFC tag (which I've stuck to my bike frame), to automatically enable GPS and start Strava (a popular cycling GPS app).
However, what I'd REALLY like it to do when it opens Strava is to go straight to the "Record a Ride" part of the app so I just have to then hit Go and I'm off. Then, when I get to the end of the ride, I'd like to tap the tag again and it will 'Finish' the ride, rather than just close down Strava completely.
Is it possible to program NFC tags with scripts that can control functions within an app, or automatically navigate to a specific portion of an app, rather than just launch/close apps?
If someone out there can help, I would forever be in your debt...
Regards,
Rob
Okay I have actually managed to answer half of my original question, here goes;
I downloaded an app called 'NFC Task Launcher', which allows you to write NFC tags. I then created a new task, under 'Applications & Shortcuts', but rather than choose 'Open Application' I went to 'Open activity', which allows you to choose a certain number of functions within an app. So you select your app, then select a function within the app. Specifically for Strava, there was one piece of code which was start a new ride ("com.strava.NewRideActivity"). This now means that when I tap the NFC tag it automatically goes to the 'New Ride' bit of Strava. Brilliant!
Now I just need to work out how to automatically end the ride when I tap it again...
Anyone else got any further?
Cheers,
Rob
I'm no expert but i think you might need 2 tags for this. If I'm correct the tag its self will have no way of keeping track of how many time its been scanned. The phone could do this but i don't know of an app that can at the moment.
The app I use (NFC task launcher) does account for this and can remember how many times the tag has been swiped, so you can create a 'toggle' function, but what it toggles is a little limited. It would be nice if I could have more control over the functionality of the apps it's controlling..
Hello,
You can implement a switch with an IF and a variable.
Code:
IF (x=0)
execute (launch workout)
x=1
ELSE
execute (close workout)
x=0
END IF
As far as I've noticed, X has to be global and at first you have to manually give it a value.
Cheers!
PS: I'll ckeck your suggested app as it's something that I've been looking for for a while.
NFC strava start tag
Hy there, the thing you want to do is exactly what i want to do, i found this app on the store , haven`t tried it yet because i haven`t got a nfc tag, but i think it will do just that ( tap to start recording, tap again to stop recording ) .
if you try this please leave a reply if you made it to work.
"One Tap Record for Strava" is the app
Is there any chance that I can use this to just hop on my bike (with an NFC or bluetooth tag on the side of the saddle) and have it record the journey automatically? I'm using Samsung S Health app but I'm willing to switch to another that's good at recording nutritional intake and physical activity.
So I have a task that is "open the door" in the tasker app but everything works great from the phone but I want to activate the same task from my moto360, I have autowear but for some reason i'm not able to get it done from the watch, any ideas?
Thanks to all
What does the task consist of? You have a smart lock on your door?
Check here to learn how to use AutoWear
joaoapps.com/autowear/
I've tried various screen off apps and they all require secondary security to turn back on when using the fingerprint scanner. Any ideas?
Would love for an option where the fingerprint scanner can also turn the screen off or even an OK Google command, but then allows the fingerprint scanner to reopen without secondary security.
+1
Sent from my Nexus 5X using Tapatalk
hmmm, you can try to use command 'input keyevent 26' , for tasker task...
this will required root though.
Jackpot! A widget pointing to a tasker task that uses secure settings to run command 'input keyevent 26' as root works like a charm!
Sent from my Nexus 5X using Tapatalk
minnemike said:
I've tried various screen off apps and they all require secondary security to turn back on when using the fingerprint scanner. Any ideas?
Would love for an option where the fingerprint scanner can also turn the screen off or even an OK Google command, but then allows the fingerprint scanner to reopen without secondary security.
Click to expand...
Click to collapse
I was just going to post a similar question. I don't have the phone yet, but i thought maybe someone can create something that allows the fingerprint scanner to turn off the screen. The finger is already in that area so it would be cool to either hold fingerprint scanner for a second to turn screen off or double tap the scanner.
jpen said:
I was just going to post a similar question. I don't have the phone yet, but i thought maybe someone can create something that allows the fingerprint scanner to turn off the screen. The finger is already in that area so it would be cool to either hold fingerprint scanner for a second to turn screen off or double tap the scanner.
Click to expand...
Click to collapse
Any solutions yet?
scottfreeze said:
Jackpot! A widget pointing to a tasker task that uses secure settings to run command 'input keyevent 26' as root works like a charm!
Sent from my Nexus 5X using Tapatalk
Click to expand...
Click to collapse
Thanks for this! Added it as a Tasker shortcut for double-tap gesture in Nova and it works like a charm.
Great tip. Got tasker set to Nova pinch out to turn off. But also have option to run task from Notification menu as well.
For those who have never used tasker before like me here is a quick note on how to set it up:
Select TASKS tab at top, select + button at bottom, give it a name (screen off) and press check mark.
You will then enter Task Edit. Press + to add an action, then select Code as your action category, then choose Run Shell.
Paste in the text: 'input keyevent 26' under the Command field. Check the Use Root option. Back out once and choose an icon for it if you want at the right lower corner. You can now place a widget for the task or launch the task with Nova etc. And/or go into Preferences and under the Monitor tab you can add it to the Notification Action Buttons.
solara1973 said:
Great tip. Got tasker set to Nova pinch out to turn off. But also have option to run task from Notification menu as well.
For those who have never used tasker before like me here is a quick note on how to set it up:
Select TASKS tab at top, select + button at bottom, give it a name (screen off) and press check mark.
You will then enter Task Edit. Press + to add an action, then select Code as your action category, then choose Run Shell.
Paste in the text: 'input keyevent 26' under the Command field. Check the Use Root option. Back out once and choose an icon for it if you want at the right lower corner. You can now place a widget for the task or launch the task with Nova etc. And/or go into Preferences and under the Monitor tab you can add it to the Notification Action Buttons.
Click to expand...
Click to collapse
Thanks for this detailed description. I've never used Tasker before either, so I'll give it a try. It's a shame such a step is required.
How was it determined that "input keyevent 26" would solve the problem? Will doing this interfere with OTA updates, since it may change a system setting?
Can I use Soft Lock Screen to turn the screen off?
Pumpino said:
Thanks for this detailed description. I've never used Tasker before either, so I'll give it a try. It's a shame such a step is required.
How was it determined that "input keyevent 26" would solve the problem? Will doing this interfere with OTA updates, since it may change a system setting?
Can I use Soft Lock Screen to turn the screen off?
Click to expand...
Click to collapse
There's a known list of Android commands that software can use to simulate some hardware presses, etc.: http://thecodeartist.blogspot.com/2011/03/simulating-keyevents-on-android-device.html
Tasker or using the keyevent 26 will not interfere with the system in any way. By sending the keyevent 26 you are doing exactly what pressing the Power button does - only with software. It does nothing to change any system settings. Not sure about the Soft Lock Screen app, but I suspect that like other software, if you use that, you will prob need to re-enter your password/pattern/pin and the fingerprint won't work. By sending the keyevent 26, you can still unlock it using the fingerprint sensor.
solara1973 said:
Great tip. Got tasker set to Nova pinch out to turn off. But also have option to run task from Notification menu as well.
For those who have never used tasker before like me here is a quick note on how to set it up:
Select TASKS tab at top, select + button at bottom, give it a name (screen off) and press check mark.
You will then enter Task Edit. Press + to add an action, then select Code as your action category, then choose Run Shell.
Paste in the text: 'input keyevent 26' under the Command field. Check the Use Root option. Back out once and choose an icon for it if you want at the right lower corner. You can now place a widget for the task or launch the task with Nova etc. And/or go into Preferences and under the Monitor tab you can add it to the Notification Action Buttons.
Click to expand...
Click to collapse
Thank you for explaining it. Does this require a root? And does it require Nova Launch?
minnemike said:
Thank you for explaining it. Does this require a root? And does it require Nova Launch?
Click to expand...
Click to collapse
It does require root to be able to let Tasker run a shell command. You would not need Nova launcher as you can easily put a widget to launch the Task within Google Now Launcher or any other launcher. Nova launcher is nice because it enables gestures and double tap to do certain actions. I have Nova to launch my phone app when I tap the Home button on the main home screen. Double tap runs my Task to turn off the phone. Pinch in, pinch out, two finger swipe down/up, etc.
Could you have something trigger Tasker to temporarily change the screen timeout to 1 second (and then change it back after the screen is off)?
solara1973 said:
It does require root to be able to let Tasker run a shell command
Click to expand...
Click to collapse
I guess I won't be using this technique then, as I don't want to root at this stage.
Is it possible to get Nova to turn the screen off by something like double-tapping on the status bar (without root and Tasker)?
Pumpino said:
I guess I won't be using this technique then, as I don't want to root at this stage.
Is it possible to get Nova to turn the screen off by something like double-tapping on the status bar (without root and Tasker)?
Click to expand...
Click to collapse
Nova launcher does not have a function to send keyevents or turn off the screen etc.
You can always try some of the Screen Off apps on the playstore and see if anyone of those allow you to unlock the phone again using Imprint. Swipe-Lock, Screen Off and Lock, Screen Lock, etc.
this one works (experimental) https://play.google.com/store/apps/details?id=com.iglint.android.screenlockpro&hl=en
it is paid one
**Update**
Added a filter for hulu only because this was causing double data entry in almost every other app.. you can also add a pipe for additional applications that need this fix.
For anyone wondering why not use "Xposed Edge" instead? Well I tried just now and there's a severe delay in emitting keyevent 23 when done via root or it is not accepted at all by hulu if it is not done on the su level sending it over shell. So either way it falls apart. Button Mapper appears to be best solution for the Enter key to become select in specific apps.
Code:
grep -E 'mCurrentFocus.*(hulu|dream|otherAppNameHere)' > /dev/null 2>&1 && /system/bin/input keyevent 23
So I recently came across a pretty awesome little remote from Amazon, the Rii MX8 Air mouse remote.
https://smile.amazon.com/gp/product/B07MHKMQ7J
Only problem was that some apps, particularly hulu, don't care for the enter key and only want to operate with the dpad_center or keycode 23. Remapping this key in the various button remappers don't work well unless it can execute an adb shell command and even then.. you better be rooted and be able to run that command as the shell user (at least for the case of Hulu).
Here is how I managed to do it. If you know of other ways then please share as this application does require that you purchase it for the pro features - adb shell commands.
https://play.google.com/store/apps/details?id=flar2.homebutton&hl=en_US
# Install Button Remapper
# Set Accessibility
adb shell pm grant flar2.homebutton android.permission.WRITE_SECURE_SETTINGS
adb shell settings put secure enabled_accessibility_services flar2.homebutton/flar2.homebutton.a.ai
adb shell settings put secure accessibility_enabled 1
# Add Button
# Remap Enter (66) to DPAD_Center (23)
# Single tap
su shell -c "dumpsys window windows | grep -E 'mCurrentFocus.*(hulu|dream)' > /dev/null 2>&1 && /system/bin/input keyevent 23"
If typing all that in looks daunting then just get to the text field and then do this over adb.
adb shell input text "string%sof%stext%sbelongs here"
ex.
Code:
adb shell input text "su%sshell%s-c%s\"dumpsys%swindow%swindows%s|%sgrep%s-E%s'mCurrentFocus.*(hulu|dream)'%s>%s/dev/null%s2>&1%s&&%s/system/bin/input%skeyevent%s23\""
You can also script it just fine via this method.
https://android.stackexchange.com/q...ble-to-write-to-a-devices-clipboard-using-adb
Just remember those WFD remote are Wifi magnets. I have just a few devices on Wifi and Ive been through several of those remotes. The remote alone killed my range, connection quality, etc. Just a heads up.
CEC is the way to go IMO. The new Roku TVs all have a secret menu that enable full CEC control that controls the FS\FTV fully.
TimmyP said:
Just remember those WFD remote are Wifi magnets. I have just a few devices on Wifi and Ive been through several of those remotes. The remote alone killed my range, connection quality, etc. Just a heads up.
CEC is the way to go IMO. The new Roku TVs all have a secret menu that enable full CEC control that controls the FS\FTV fully.
Click to expand...
Click to collapse
Unless I missed something, and I doubt that I have given the sheer amount of time I have spent on this, the RokuTV with CEC enabled via hidden menu is next to useless. The back button and home button collide with the device itself - there's no intelligence built in to prevent it from interacting and doing what it would normally do for the RokuTV itself. That would also be expected because otherwise you'd get stuck inside your hdmi device.
Personally I have not been experiencing any wireless interference with this remote and given the amount of wifi I am actually around atm I'd say that is fairly impressive. That is not to say I am not interfering with a neighbor in reality, but my 2.4 and 5ghz networks appear to be operating fine.
In fact I had to switch my TV over from 5ghz to 2.4ghz because 2.4ghz penetrates walls better, this device is 2.4ghz as well but I am sure it is in a frequency that is outside the wifi range.
glitchbit said:
Unless I missed something, and I doubt that I have given the sheer amount of time I have spent on this, the RokuTV with CEC enabled via hidden menu is next to useless. The back button and home button collide with the device itself - there's no intelligence built in to prevent it from interacting and doing what it would normally do for the RokuTV itself. That would also be expected because otherwise you'd get stuck inside your hdmi device.
Personally I have not been experiencing any wireless interference with this remote and given the amount of wifi I am actually around atm I'd say that is fairly impressive. That is not to say I am not interfering with a neighbor in reality, but my 2.4 and 5ghz networks appear to be operating fine.
In fact I had to switch my TV over from 5ghz to 2.4ghz because 2.4ghz penetrates walls better, this device is 2.4ghz as well but I am sure it is in a frequency that is outside the wifi range.
Click to expand...
Click to collapse
Home button is only for the TV to return to its home. There is no CEC home button.
Back button works absolutely perfectly via IR. Not a single problem. Done this on 2 TCLs and one Hisense.
The menu Im talking about is Home 5x rw,down,ff,down,rw.
I dont know where you got that idea of the devices colliding, they just limit CEC functionality on these TVs to keep people away from the ability to add and fully operate the TV and FS without ever going into the TV itself.
Update: Ignore this musing, the hulu app does not experience any further issue with the command mentioned in the first post. There is a potential for other apps to misbehave if it listens to both Enter and Select, but given the filter you'd have to add it to the command before finding out and even then there appears to be ways to mitigate the issue if it occurs.
--------------------------------------------
I may need to revise this more still & add in a filter to detect either a soft keyboard or text input field. I suspect the above fix may still result in double entry in the Hulu app.
This really needs to be fixed in the Button Mapper app as double input on that key shouldn’t happen if it’s remapping correctly, but being android inconsistency always abound.
adb shell dumpsys window InputMethod | grep "mHasSurface"
https://stackoverflow.com/questions...-keyboard-is-visible-on-android-device-or-not
TimmyP said:
Home button is only for the TV to return to its home. There is no CEC menu button.
Back button works absolutely perfectly via IR. Not a single problem. Done this on 2 TCLs and one Hisense.
The menu Im talking about is Home 5x rw,down,ff,down,rw.
I dont know where you got that idea of the devices colliding, they just limit CEC functionality on these TVs to keep people away from the ability to add and fully operate the TV and FS without ever going into the TV itself.
Click to expand...
Click to collapse
I own 2 RokuTVs myself, sold one of them due to a move, but I really do like them tbh. Where I got the idea was from personal experience. The home button kicks me out to the home screen any time it is used (Initially w/ a 5 second delay before going back in - now it just sits there), the select button shows the input I am on overlaid on the bottom half & the select button also kicks me out to the home screen w/ my hdmi input device highlighted.
The feature is hidden because it naturally collides.. maybe they fixed it in your version & I need to update mine, but in my current version it’s completely unusable when it’s fully enabled via the hidden menu. And I know what menu you’re talking about - we’re on the same page - it just doesn’t work on my RokuTV.
I'm trying to start the screensaver service with a remote press using 'X edge Pro' on a rooted Firestick.
Can't find the activity that starts the screensaver?
Basically I want to hold down a button to start the screensaver.
Currently the only way I've found is to point to Aerial Dream and start the 'Test Activity'
If anyone knows a way I can do this your help would be greatly appreciated.
You can launch whatever screensaver you currently have active with this:
Code:
ADB shell input keyevent KEYCODE_SOFT_SLEEP
It's case sensitive
Finnzz said:
You can launch whatever screensaver you currently have active with this:
Code:
ADB shell input keyevent KEYCODE_SOFT_SLEEP
It's case sensitive
Click to expand...
Click to collapse
Amazing, thankyou.
Rather than using the ADB command, I found X Edge Pro has a 'inject key event'. I found the KEYCODE_SOFT_SLEEP there.
Thankyou for you swift reply. Really helped