[Project] multi-function (long press) volume buttons - Tasker Tips & Tricks

Requirements:
Tasker
AutoInput (paid version)
(tested on Nexus 5x)
I never used the volume controls unless I was listening to music so I decided to get creative with tasker.
I've used this profile for a few weeks now and it works very well, there might be some misinterprets (I've had 2 in total) if the phone is lagging heavily (like when casting and playing a video),
but I only encountered this issue once in a few weeks of use (and I've had problems with tasker and lag on other profiles), anyway your mileage might vary depending on your usage.
It also controls headphone and bluetooth volume.
**What it does**:
Reprograms the volume buttons to have a short press and long press function, depending on if media is playing they have different functions (completely customizable).
By default, if media is playing it will control media volume, if it's a long press (and it's playing) it will launch apps. If nothing is playing it will simply launch apps or whatever you want it to do (so that's 4 functions per "is media playing" state).
This is very useful for portait toggle, flashlight or even notifications pull down for those awkward hand position moments to give a few ideas.
**How it works**:
On button down events, it will check if media is playing (every 1.5s at most, this info is used to determine the button action in later if statements), then it will wait for 1.5s (by default),
if the wait is not intercepted by a button up event (short press) within those 1500ms, it will be registered as a long press.
After this comes a bunch of if statements that use the above information to choose the right action (is media playing, was it a long press?).
I'd suggest taking a look at all the tasks and profiles to see how they work, I also added a profile which disables the custom keys (and re-enables the stock function) when a call is active.
These are the main components of this project to make it work if you want to get creative yourself.
manage = CONTEXT.getSystemService (audio );
%playing = manage.isMusicActive();
Click to expand...
Click to collapse
(credit goes to the internet/google)
and AutoInputs key suppress function and key up/down event profile triggers.
**How to set up**:
Import project, use the suppress task to enable key suppression (this must be done once to disable the stock key functions).
You can then tweak the vol up/down tasks to accommodate your needs.
the first set variable %longpressduration should be pretty obvious
scrolling down to the if statements you can change the actions for each event, it can be anything, even other profiles, I'd say sky's the limit but it's tasker in this case
I don't know if these things get exported, but make sure the button up events have a higher priority than then down events.
Download:
https://drive.google.com/file/d/0Byn3Aaml1wlcRENBMTB0MVFXczA/view?usp=drivesdk

Shebee said:
Requirements:
Tasker
AutoInput (paid version)
(tested on Nexus 5x)
I never used the volume controls unless I was listening to music so I decided to get creative with tasker.
I've used this profile for a few weeks now and it works very well, there might be some misinterprets (I've had 2 in total) if the phone is lagging heavily (like when casting and playing a video),
but I only encountered this issue once in a few weeks of use (and I've had problems with tasker and lag on other profiles), anyway your mileage might vary depending on your usage.
It also controls headphone and bluetooth volume.
**What it does**:
Reprograms the volume buttons to have a short press and long press function, depending on if media is playing they have different functions (completely customizable).
By default, if media is playing it will control media volume, if it's a long press (and it's playing) it will launch apps. If nothing is playing it will simply launch apps or whatever you want it to do (so that's 4 functions per "is media playing" state).
This is very useful for portait toggle, flashlight or even notifications pull down for those awkward hand position moments to give a few ideas.
**How it works**:
On button down events, it will check if media is playing (every 1.5s at most, this info is used to determine the button action in later if statements), then it will wait for 1.5s (by default),
if the wait is not intercepted by a button up event (short press) within those 1500ms, it will be registered as a long press.
After this comes a bunch of if statements that use the above information to choose the right action (is media playing, was it a long press?).
I'd suggest taking a look at all the tasks and profiles to see how they work, I also added a profile which disables the custom keys (and re-enables the stock function) when a call is active.
These are the main components of this project to make it work if you want to get creative yourself.
(credit goes to the internet/google)
and AutoInputs key suppress function and key up/down event profile triggers.
**How to set up**:
Import project, use the suppress task to enable key suppression (this must be done once to disable the stock key functions).
You can then tweak the vol up/down tasks to accommodate your needs.
the first set variable %longpressduration should be pretty obvious
scrolling down to the if statements you can change the actions for each event, it can be anything, even other profiles, I'd say sky's the limit but it's tasker in this case
I don't know if these things get exported, but make sure the button up events have a higher priority than then down events.
Download:
https://drive.google.com/file/d/0Byn3Aaml1wlcOFVFYWZUSC1DWlE/view?usp=drivesdk
Click to expand...
Click to collapse
Nice job.
Another alternative for the same functionality is this
https://play.google.com/store/apps/details?id=com.spazedog.xposed.additionsgb

vickylahkarbytes said:
Nice job.
Another alternative for the same functionality is this
https://play.google.com/store/apps/details?id=com.spazedog.xposed.additionsgb
Click to expand...
Click to collapse
I updated my link, tweaked the settings a bit.
Nice, will definitely check it out since I've got xposed installed! For those that don't, you can give this project a try.
Edit:after trying it out it seems to respond somewhat faster under certain circumstances, but it doesn't allow to check for media playback. So I guess depending on your needs you night want to use one or the other

Related

Basic issue with Windows Media Player

I recently got an O2 XDA IIi (Alpine) and have fiddled about with it a bit, not gone as far as flashing the ROM or whatever. Havn't even paid for it, so don't really want to totally screw it just yet.
What I have done is transfer some songs to my SD card, and I listen to them whilst travelling to work. I just put WMP on to play, and manually disable the backlight at the moment, but its still possible for buttons or the screen to get pressed.
Simply put, short of getting a full case for it or turning it off (which stops Media Player playback) is there anyway to lock the touchscreen and hard buttons, ie: like the original Nokia Menu > * keylock? I will eventually get a case for it, but right now I've got -zero- money.
I've searched as far as I'm able this evening, and have come up with nada!
I've got a quick fix for this, in that I set my PDA to password-lock at 0 minutes, turn off the backlight manually and then turn it off and on again.
Is there a simpler way to accomplish this?
On your way to work, you could also read the manual whilst listening to the sweet music. Then you would realise that your "solution"is not the best you can find :shock:
Seriously, you can set a hardware button by clicking on Menu>Options in windows media player and set hardware button for whatever you want 8)
That works fine, but it doesn't have any keylock function. The closest is "toggle screen", but that doesn't disable any of the hard buttons (The hangup/pickup, camera, notes, calender, contacts buttons)
Also, it'd be hard to read the manual when I'm cycling to work
I use GSPlayer http://hp.vector.co.jp/authors/VA032810/
It is lot lighter, stable and has better playlist support. It has shut-off screen and buttons lock option that you can assign to a h/w button. Very handy.
Is there an MPEG4 AAC codec/plugin for GS? I've got TCPMP at the moment with the AAC codec from rareware.
Also got a free leather case from work, so it's not too much of a problem now.
Tried ScreenLock? http://www.pocketgear.com/software_detail.asp?id=14621
It's freeware.
I used to have another locking app on my XDA, but lost it when I hard reset, and now I can't remember its name Its icon was a big yellow padlock though, and it let you lock the keys by clicking on the shortcut in the Start menu, and you pressed and held down a combination of keys you set up during the installation process, which would unlock the device again (I chose the top button + the action button, for simplicity's sake).
Previously i used Resco Audio. Because it has automatic screen toggle function, and also, when riding bike or driving, it easy to skip songs by pressing either the camera or recorder button.
But for now i just stick to WMP10 since the volume control is differentiated with the phone's volume control. Unlike Resco Audio, when i try to lower the sound using hard button, the phone volume also lowers at the same time... making me missed my important calls. OTOH, I use SPB pocket plus, and put the screen toggle button on the today's screen. Hope my solution could solve your problem. TQ
Use psShutxp
Do a google search for psshutxp (make sure you get the one for a QVGA screen (NOT VGA)). The site is in Russian, but there's also an English version of the website. It's a free app that simulates the "Log off" screen of Windows XP. When the "Log Off" screen pops up, there's a button (the left one) that says "Light Off". It turns off the screen (not just the backlight) and prevents any "input".
I'm listening to Erasure on WMP using this. It should work for you. It does not disable the hardware buttons (i.e. if you press the contacts button, the Contacts application will be launched (but it will not turn the screen back on)) but I don't see that as a big issue.
Justin

Profiles for Windows Mobile

Does anybody know/use this program?
I think its THE application that I love the most on my PocketPC/Herald, but I never see it mentioned anywhere.
So I've deciced to make a post about the possibilities of this program:
(No I DO NOT work for them or know any of them personally )
What is it?:
- A piece of software that will let me create custom (phone) profiles for Windows Mobile Professional devices.
So, ok there are more programs like this, so why this program?:
- Because it is VERY clean on your TodayScreen, just one line displaying the profile selected.
So what makes me so excited about Profiles for Windows Mobile?
- Because every custom made profile allows you to run a program of choice.
You can then link that profile to start at a certain time, or start it manually by pressing a software button (or select the profile from the dropdown list on the todayscreen)
or a hardware button.
- You can also enable/disable the Phone/Wifi/Bluetooth per profile.
- You can also switch the screen (portrait/landscape) per profile.
This allows me to do the following on my Herald:
- I've created these profiles, which perform these steps:
* normal
this profile sets the phone volume to normal volume and starts every day at 7am.
* silent
this profile I select by hand if I don't want to be interrupted
* vibrate
this profile I select by hand and puts the Phone on...vibrate (go figure), nice for meetings
* internet
now it gets good, this profile I select by hand (an icon under programs) and does the following:
- sets the call/sms volume to a certain volume
- enable the WiFi connection
- start PocketIE
* itunes
i love this one 2, does the following (when I tap on the icon)
- sets the call/sms volume to a certain volume
- enable the WiFi connection
- start Salling Clicker (remote control for installed itunes on my pc)
* headphone
this is the most used one and I start it by simply pressing once on the right softkey button on my Herald:
- sets the volume of the phone ringer/sms low
- starts Coreplayer
Now I don't go DEAF anymore when someone is calling me
Here's the official site, but I really do recommend you get the slightly older version: 2.1.0.558, because it's slightly faster and works beautifully under WM6.1.
http://www.winmobileapps.com/device/pocketpc/pwm/pwm.aspx
Edit: I know this looks like a big advertisement, but I just like the program and want to bring it under your attention and show you the possiblilities

[Q] Volume sliders linking app?

I've been trying to sort out the volume controls on droid to get them to behave how I want and after trying various different 3rd party apps to do this I still haven't made it do what I want. It's getting a little frustrating now!
So at the risk of being told "This has been asked before" and being shown threads I've already read and links I've tried out, I'm resorting to asking.
Basically what I'm looking for is that ALL of the individual volume controls are linked together to the main volume rocker switch, and/or the ringtone volume setting. What I mean by that is that when I hold the switch down to make the phone quieter or silent, I want ALL the other volume controls (media/notifications/alarms etc) to use the exact same setting. And the same when the volume is increased.
And when I mention ringtone volume setting I mean that (if possible) when I add say a profile switching shortcut on the home screen and choose a silent/vibrate/normal profile that the same behaviour applies, ie all the volume controls get set the same.
If I was being choosy, in an ideal world it would be nice to be able to choose any particular control and have it excluded from this behaviour as I see fit, but that's a nice to have - beggars can't be choosers!
The important thing is basically when I turn the volume rocker down that I want my phone to make all the volume settings go down etc like they're one overall setting not a bunch of separate ones.
In terms of implementation I'm not sure if this will sound how I mean it to, but I don't really want to have to keep messing with an app to change settings, or have to have a shortcut that needs to be used etc. So with that in mind is there such a thing that just installs and has no interface of its own per se but actually fundamentally changes the way the standard volume controls and settings work and are presented to you?
That's ultimately what I'd love to have rather than a 'bolt on' that I need to remember is there and have to meddle with all the time. I hope that makes sense, and I'd certainly try out a solution that only ticks 'some' of the boxes than have no suggestions at all.
Sorry if this sounds similar to other threads on volume control. I've read several similar ones, and have tried many 3rd party volume/mute apps etc but have not yet found one that just links the separate volume sliders together in this way in such a simple fashion. I'm sure there must be one like this, but I've not found it yet so appreciate a pointer in the right direction!
Cheers
Looking for this aswell, but I was never able to find it
Just a quick update for anyone searching - I found an app called 'Master Volume' which has worked for me.
It doesn't offer anything in terms of exceptions or individual control I don't think, but importantly it DOES link the volume controls together and links them at the same time to the rocker switch on the phone.
So you install it, then I opened the all and it says to just leave the service running in the background (so I set my task killer app to ignore the process). That's it. It just seems to work no problem.
Result!

Car Installs - Triggering a Tasker Task from Keyboard

Hi,
I am having difficulty getting something I would think easy to work on my Nexus for my car install.
I was wondering how people are getting tasker tasks to be triggered off keyboard hotkeys when using either their Joycon or a standard external keyboard.
It seems from research the way to do this used to be quick launch shortcuts (assigning search key + a letter) to an app or shortcut but it seems these do not work for me in android 4.4?
External keyboard helper lets you launch applications from hotkeys, but seems to give no way of launching tasker tasks.
This is really doing my head in! From youtube it looks like others have no issues doing this. Any help would be greatly appreciated!
Well, the only thing I can think of right now is to use a Tasker Scene with a focused textbox to detect the keys. You will have to run this scene as a dialog, and deal with all the complications with that... (touch disabled outside of dialog, etc) but here's another idea.
You could use a mobile bluetooth keyboard (or any keyboard that has volume/brightness keys) and have a Tasker profile pick up a change in the ringer volume variable, this would give you 2 or 3 hotkeys (vol up, down, or mute). If you don't have a keyboard like that you could edit the Android keymappings under /system/usr/keylayout/General.kl to incorporate volume changes under some key.
Sent from my SCH-I605 using xda app-developers app
Good idea with detecting the variable changes! I'm using an Arduino Micro which emulates a keyboard so I will have no problem emulating them via buttons & changing the keyboard layout kl if nessesary. Thanks
I am currently working on the same topic: Here is my workaround for trigger a task with an external bluetooth keyboard.
create a task in Tasker
create an app of this task with Tasker App Factory
remap a key of the keyboard to the new app with External Keyboard Helper
Finish
Maybe this is helpful
Thomas
What are you trying to accomplish?
Lokifish Marz said:
What are you trying to accomplish?
Click to expand...
Click to collapse
1. With a bluetooth remote (Satechi BT MediaRemote) i want to switch between the homescreen by pushing a key. (launcher nova and tasker secure settings are necessary)
2. a tasker scenes (dialog) with different options should open by pushing another key. Navigation in the scene should do also with the Bluetooth remote (not yet finish).
The goal is an intuitive handling of the tablet ui in the car with less touch-input on the screen. Something like Audi MMI or BMW idrive.
In my opinion to find icon on the homescreen while driving is difficult.
Here is my current set up.
Nexus 7 (In dash)
Center console mounted volume dial with push to mute (Tablet>dial>amp)
(Not shown in the screencap is that the media widget is also in the Navbar and accessed via a softkey in the navbar)
The console dial was initially a USB 5 button mouse with key remapping but required the amp gain be cranked up which caused issues.
Now for full control you need the following;
(Some of these things can be eliminated with voice controls)
Media Control (Previous, Play/Pause, Next, Playlist, etc.)
Directional controls (Up, Down, Left, Right)
Action Controls (Select, Home, Back, Recent, Menu)
Phone Control (Answer, Hangup, Dialpad)
SMS Control (Full KB or voice to text using a noise canceling mic)
If you skip voice control and you don't count the dialpad or KB, you need 15 buttons or adaptive input based on what app is running but still need at least 5-6 buttons. I am not sure how involved implementation of adaptive input would be as I gave up after days of trying to get it just right.
With the Satechi BT MediaRemote, you can cover most of this by key remapping but have to remember what keys are what. The advantage of proper key remapping is that it removes the need for additional apps to get it to work.
Seeing that I'm not sure how complete of a setup you are trying to get, it's hard to offer anymore advice.

Toggle pause with bluetooth media button

Hello,
I've got a shiny new media bluetooth button for the car, and of course the first thing I want to do is make it go through tasker so I can get lots of lovely functionality. I've got single press, double press, and long press for the Next and Previous buttons working fine, but I'm having trouble with the Play button. I still want it to toggle the pause, but when I do that (using Media Control: Toggle Pause, Simulate Media Button On), the music player (GMMP in this case) grabs the media control focus, and all the buttons revert to the music player, instead of my wonderful tasker stuff. I've tried setting an exit task with Media Button Events Grab but that doesn't work. I'm not sure if it's possible short of sending an intent - I found a togglepause intent, but I'm not sure how to write it (found from https://stackoverflow.com/questions...of-another-music-player-from-my-code#17286986 ) for tasker, or even if that's the best way of doing it.
Any help appreciated!
If found the intent for GMMP to play/pause, and it works, but the minute it's done, the media controls revert back to GMMP (even though they are set to not to be used).
I tried PowerAmp too (because I found an intent for it), and it will work the first time, but after that the media controls stop responding at all (previous/next/play).
I've even added a new Media Button Events: Grab right after the intent is sent, but it doesn't seem to do it.

Categories

Resources