[DIY | TASKER] Use any bluetooth headset as remote camera shutter

aikon96

Senior Member
Sep 24, 2010
130
44
0
Hey Guys,

I was searching for a bluetooth remote app to control camera app of my phone.
I only found some app:

https://play.google.com/store/apps/details?id=com.apprture.bluetooth_shutter

but the limitations were too uncool (only specific BT headset compatible).
Also I found a "Muku Labs Camera Shutter Remote Control for iOS and Android Devices", but with an expensive price...

So I looked arround and tried LLama and Tasker to get my "Sony SBH20" headset working.
Now, I created a tasker profile to get any kind of bluetooth headset working witch any camera app. I think this should also work on any other phone.

The only things you need is:

- ROOT
- Tasker App (3$) https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm&hl=de

- Bluetooth Headset with buttons

Ok, so here is my tasker profile:




Trigger:
-> Display on
-> Media Button -> button "play" -> grab [x]

-> App at foreground (all sony camera apps (AR-Effect, etc...))

So if, all of these triggers are set, the task "Bt CAM SHUTTER" will be started:

Run Shell
-> Command:
input tap 1090 300
(This will emulate a touch at the camera button on your screen at: x= 1090px y=300px)
-> Set "use Root"



Congratulations, you got it!

Now start your sony camera app, connect your BT headset and press play button.
Hope I could help someone!

If you want to use this on any other phone / app, you have to modify the command. If you need to know, where the touch emulation has to be, you have to go to android settings -> dev. settings -> show cursor position:



Note: You can download the latest profiles and tasks here:
http://forum.xda-developers.com/showpost.php?p=54574088&postcount=14
 
Last edited:

aikon96

Senior Member
Sep 24, 2010
130
44
0
Trigger:
<TaskerData sr="" dvi="1" tv="4.3u4m">
<Profile sr="prof9" ve="2">
<cdate>1401550126651</cdate>
<edate>1401688701016</edate>
<id>9</id>
<mid0>2</mid0>
<nme>Trigger BT Remote</nme>
<State sr="con0" ve="2">
<code>123</code>
<Int sr="arg0" val="1"/>
</State>
<State sr="con1" ve="2">
<code>105</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="1"/>
<Int sr="arg3" val="0"/>
</State>
<App sr="con2" ve="2">
<cls0>com.sonymobile.androidapp.cameraaddon.areffect.AREffectApp</cls0>
<cls1>com.sony.motionshot.unlock.animation.UnlockAnimationActivity</cls1>
<cls2>com.sony.motionshot.record.RecordActivity</cls2>
<cls3>com.sonymobile.backgrounddefocus.ViewFinderActivity</cls3>
<cls4>com.sonyericsson.android.camera.CameraActivity</cls4>
<cls5>com.sonymobile.motiongraphforxperia.CaptureActivity</cls5>
<flags>2</flags>
<label0>AR-Effekt</label0>
<label1>Bewegungsaufnahme - Effekt [Animation]</label1>
<label2>Bewegungsaufnahme</label2>
<label3>Hintergrund-Unschärfe</label3>
<label4>Kamera</label4>
<label5>Motiongraph for Xperia™</label5>
<pkg0>com.sonymobile.androidapp.cameraaddon.areffect</pkg0>
<pkg1>com.sony.motionshot.unlock.animation</pkg1>
<pkg2>com.sony.motionshot</pkg2>
<pkg3>com.sonymobile.backgrounddefocus</pkg3>
<pkg4>com.sonyericsson.android.camera</pkg4>
<pkg5>com.sonymobile.motiongraphforxperia</pkg5>
</App>
</Profile>
<Task sr="task2">
<cdate>1401548223226</cdate>
<edate>1401652399441</edate>
<id>2</id>
<nme>Bt CAM SHUTTER</nme>
<pri>10</pri>
<Action sr="act0" ve="5">
<code>443</code>
<Int sr="arg0" val="4"/>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act1" ve="5">
<code>123</code>
<Str sr="arg0" ve="3">input tap 1090 300</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="1"/>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
</Action>
<Action sr="act2" ve="5">
<code>254</code>
<Int sr="arg0" val="1"/>
</Action>
<Action sr="act3" ve="5">
<code>30</code>
<Int sr="arg0" val="100"/>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act4" ve="5">
<code>538</code>
<Str sr="arg0" ve="3">Remote Pic</Str>
<Str sr="arg1" ve="3"/>
<Img sr="arg2" ve="2"/>
<Int sr="arg3" val="0"/>
<Str sr="arg4" ve="3">/system/media/audio/camera/sound1/shutter_done.wav</Str>
<Int sr="arg5" val="3"/>
</Action>
<Action sr="act5" ve="5">
<code>30</code>
<Int sr="arg0" val="300"/>
<Int sr="arg1" val="2"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act6" ve="5">
<code>254</code>
<Int sr="arg0" val="0"/>
</Action>
</Task>
</TaskerData>


Task:

<TaskerData sr="" dvi="1" tv="4.3u4m">
<Task sr="task2">
<cdate>1401548223226</cdate>
<edate>1401652399441</edate>
<id>2</id>
<nme>Bt CAM SHUTTER</nme>
<pri>10</pri>
<Action sr="act0" ve="5">
<code>443</code>
<Int sr="arg0" val="4"/>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act1" ve="5">
<code>123</code>
<Str sr="arg0" ve="3">input tap 1090 300</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="1"/>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
</Action>
<Action sr="act2" ve="5">
<code>254</code>
<Int sr="arg0" val="1"/>
</Action>
<Action sr="act3" ve="5">
<code>30</code>
<Int sr="arg0" val="100"/>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act4" ve="5">
<code>538</code>
<Str sr="arg0" ve="3">Remote Pic</Str>
<Str sr="arg1" ve="3"/>
<Img sr="arg2" ve="2"/>
<Int sr="arg3" val="0"/>
<Str sr="arg4" ve="3">/system/media/audio/camera/sound1/shutter_done.wav</Str>
<Int sr="arg5" val="3"/>
</Action>
<Action sr="act5" ve="5">
<code>30</code>
<Int sr="arg0" val="300"/>
<Int sr="arg1" val="2"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act6" ve="5">
<code>254</code>
<Int sr="arg0" val="0"/>
</Action>
</Task>
</TaskerData>
 
Last edited:
  • Like
Reactions: TheEndHK and Xaeons

Xaeons

Senior Member
Aug 27, 2010
227
34
0
Manila, PH
It works! I also have an SBH-20 and I could never figure out how to make this work. Thanks to this I could have all sorts of BT Triggers :D

If anyone's interested, I attached the xml file for tasker importing, just add AR in the application context if you have it coz I uninstalled it from my phone.
 

Attachments

Last edited:

Xaeons

Senior Member
Aug 27, 2010
227
34
0
Manila, PH
Nice to hear. Enjoy!
I'm just trying to get Shutter sound via soundspeaker while connected via Bluetooth...
Yeah I noticed that too. Sometimes the shutter sound plays on the first try, but never plays on the consecutive tries, even when shutter sound is set to on in the camera settings.

On a side note, it works on my old MW600! (which I would really love to use instead of the SBH20 but the clip broke :() At least it'll have some use instead of gathering dust.

EDIT: I've been trying to get SoundAbout to work on this, but I have no luck. Don't want to buy the pro version if it won't work.
 
Last edited:

Xaeons

Senior Member
Aug 27, 2010
227
34
0
Manila, PH
Nice to hear. Enjoy!
I'm just trying to get Shutter sound via soundspeaker while connected via Bluetooth...
Got it to work, albeit a slight workaround.

I used Play Ringtone instead of notify. It'll play even if phone is set to Vibrate mode because of the Notification volume action.
Can anyone test? I attached the tasker profile (unzip then import in tasker).
 

Attachments

ovgandroid

Senior Member
Apr 11, 2012
76
5
0
Hey guys, anyone have any idea how to stop Google now/S voice opening whenever I click the button on my headset? If possible can it be done so that it is only disabled while in the camera app??
 

TheEndHK

Senior Member
Apr 25, 2011
2,667
808
0
Hey Guys,

I was searching for a bluetooth remote app to control camera app of my phone.
I only found some app:

https://play.google.com/store/apps/details?id=com.apprture.bluetooth_shutter

but the limitations were too uncool (only specific BT headset compatible).
Also I found a "Muku Labs Camera Shutter Remote Control for iOS and Android Devices", but with an expensive price...

So I looked arround and tried LLama and Tasker to get my "Sony SBH20" headset working.
Now, I created a tasker profile to get any kind of bluetooth headset working witch any camera app. I think this should also work on any other phone.
You are very smart and clever, I want to do that with tasker for a long time but just have no time to research things.

I've tested it works on my bluetooth handset but can't do burst shooting, only can take single picture. Is that possible to make it also works in burst mode?
 

aikon96

Senior Member
Sep 24, 2010
130
44
0
You are very smart and clever, I want to do that with tasker for a long time but just have no time to research things.

I've tested it works on my bluetooth handset but can't do burst shooting, only can take single picture. Is that possible to make it also works in burst mode?
Hm, yap it seems like this can be done, but you'll need to emulate the camera hardware button.

Have a look here:
https://groups.google.com/forum/#!topic/tasker/LJhmfxT2mj8[1-25-false]

But you'll need this plugin:
http://forum.xda-developers.com/showthread.php?t=734370

All you need to do:
- Install plugin
- create new task -> select "plugin" section -> select "execute" --> select "edit" and enter
"input keyevent 27"
Now start this new task with the already available bluetooth trigger and you're done.

Just realized that you need long press emulation for camera button, so look here also:
https://groups.google.com/forum/#!topic/tasker/LJhmfxT2mj8[26-50-false]


I'm just at work, otherwise I already had tried it... If someone is faster than me, you can post the tasker profile here ^^
 
Last edited:
  • Like
Reactions: TheEndHK

TheEndHK

Senior Member
Apr 25, 2011
2,667
808
0
Hm, yap it seems like this can be done, but you'll need to emulate the camera hardware button.

I'm just at work, otherwise I already had tried it... If someone is faster than me, you can post the tasker profile here ^^
I just took a brief reading but I'm not familiar with tasker so I got many newbie questions to ask.

I guess the 27 KEYCODE_CAMERA is to emulate the hardware shutter key present on z1c? So, I think maybe it can launch the camera up by using our remote even the screen is off? and I also found 4 KEYCODE_BACK so I can remote turn off the camera by emulate to press the back button and also using 26 KEYCODE_POWER to lock the screen remotely?

In that specific thread, the guy wanted to emulate a long press on power button to call up the phone restart/shutdown menu but he used sendevent method, not the input keyevent.

!sendevent /dev/input/event5 1 116 1
!sendevent /dev/input/event5 1 116 0
!sendevent /dev/input/event5 1 116 1
sleep 1
!sendevent /dev/input/event5 1 116 0

The first line is to emulate the hold down and press on power and the second line is to emulate release the power button. This two commands combined will unlock the screen(assume the lockscreen is disabled). The third line is to emulate again to press the power but this time the forth line will emulate to press it for one second then the fifth line to release it again. This will open the phone restart/shutdown menu.

But how can I do that for burst shooting?
 

aikon96

Senior Member
Sep 24, 2010
130
44
0
@TheEndHK:

Sooooryyyy, there was a misunderstanding... :D
I thought u want to use the "burst" shooting, which is implemented by sony, when you are holding the camera button when you are using the sony camera app... So now I understood what you meant... Didn't realize that the bursh shot mode isn't available at tasker app selection, so I had to modify the tasks.

Now, when you start your camera app, the bluetooth will always trigger the touch input, even when you are not at camera app, until you turn off your display again.

In short:
Camera app on: --> Bluetooth trigger enabled
Display off: --> Bluetooth trigger disabled until you start camera app again

BTW: In zip file you'll find also the modified cam_shutter task, which will play a shutter sound (so you'll know, when trigger has finished).
Thanks for Xaeons again, who found the solution for playing sounds at camera.^^
 

Attachments

  • Like
Reactions: TheEndHK

aikon96

Senior Member
Sep 24, 2010
130
44
0
Hey guys, anyone have any idea how to stop Google now/S voice opening whenever I click the button on my headset? If possible can it be done so that it is only disabled while in the camera app??
To disable Google now meanwhile camera app, you'll need to install "Secure Settings" (plugin for Tasker).
Then, setup a trigger:

When Camera app active -->
TASK: disable google now

Select Action Category "Plugin" -> Secure Settings -> Configuration -> Root Actions -> Package State -> choose Google Now -> check "disable"

Camera app inactive --> enable google now
Select Action Category "Plugin" -> Secure Settings -> Configuration -> Root Actions -> Package State -> choose Google Now -> check "enable"

This will freeze Google Now until you leave camera app.
Hope I could help...
 
  • Like
Reactions: TheEndHK

TheEndHK

Senior Member
Apr 25, 2011
2,667
808
0
@TheEndHK:

Sooooryyyy, there was a misunderstanding... :D
I thought u want to use the "burst" shooting, which is implemented by sony, when you are holding the camera button when you are using the sony camera app... So now I understood what you meant... Didn't realize that the bursh shot mode isn't available at tasker app selection, so I had to modify the tasks.
??? no misunderstanding there, I was just figured tasker remote is funny only.:laugh: I mainly want the burst shooting by Sony and yes it is holding the camera button to do it. Do you have any idea?

I guess can't just use single method(like ask the remote to press play button) to do burst because this is a single action. We have to use like sendevent to emulate a long press 10s and then ask the play button to active it but then everytime we will have to take a 10s burst shooting.
 

ovgandroid

Senior Member
Apr 11, 2012
76
5
0
To disable Google now meanwhile camera app, you'll need to install "Secure Settings" (plugin for Tasker).
Then, setup a trigger:

When Camera app active -->
TASK: disable google now

Select Action Category "Plugin" -> Secure Settings -> Configuration -> Root Actions -> Package State -> choose Google Now -> check "disable"

Camera app inactive --> enable google now
Select Action Category "Plugin" -> Secure Settings -> Configuration -> Root Actions -> Package State -> choose Google Now -> check "enable"

This will freeze Google Now until you leave camera app.
Hope I could help...
Brilliant! I'll let you know how I get on
 

ovgandroid

Senior Member
Apr 11, 2012
76
5
0
To disable Google now meanwhile camera app, you'll need to install "Secure Settings" (plugin for Tasker).
Then, setup a trigger:

When Camera app active -->
TASK: disable google now

Select Action Category "Plugin" -> Secure Settings -> Configuration -> Root Actions -> Package State -> choose Google Now -> check "disable"

Camera app inactive --> enable google now
Select Action Category "Plugin" -> Secure Settings -> Configuration -> Root Actions -> Package State -> choose Google Now -> check "enable"

This will freeze Google Now until you leave camera app.
Hope I could help...
ok, this works - both are disabled, thank you...

But it still wouldn't work, I finally realised that nothing was even starting in the tasker profile 'trigger BT remote' so I tested it with a wired headset and it worked! because it uses a play/pause button : /

But the bluetooth headset does not and I cant find anything to detect this button - at first I thought it was the menu long press since both bring up google now... but no it is different... Any ideas? do you know of an app that can tell me what button is being pressed (on headset), I tried using a logcat but I couldn't see anything (But then again I'm not sure how to use it :confused:)


Edit: could it be the same as the double tap home button?
 
Last edited:

aikon96

Senior Member
Sep 24, 2010
130
44
0
ok, this works - both are disabled, thank you...

But it still wouldn't work, I finally realised that nothing was even starting in the tasker profile 'trigger BT remote' so I tested it with a wired headset and it worked! because it uses a play/pause button : /

But the bluetooth headset does not and I cant find anything to detect this button - at first I thought it was the menu long press since both bring up google now... but no it is different... Any ideas? do you know of an app that can tell me what button is being pressed (on headset), I tried using a logcat but I couldn't see anything (But then again I'm not sure how to use it :confused:)


Edit: could it be the same as the double tap home button?
Hm, didn't try that app, but this could help you:
https://play.google.com/store/apps/details?id=com.kober.headset&hl=de

I think, your headset has only one button so this button is for answering calls. Perhaps try also long pressing this button...
The good thing in this app: it can use also Tasker profiles/tasks...
Give it a try...

@TheEndHK:

Huh? Okay...
So I'll try a trick... ;) I cannot test it, cause I've disabled burst mode in some Xposed module and didn't find the option to enable it again, so please report if this thing works:

I think, longpress at touchscreen at camera button should also result into a burst shooting, so here we go.
This task will emulate a minimal swipe at the camera button --> long press.
So, default long press is set to 5000ms = 5secs...

All you have to do: Import this task, and add a new trigger (vol up/down) to start this task and report back...
BTW: U can also set the pause/play LONGPRESS trigger, just enable "Held down" at button trigger "Media Button".

--> short press button-> single pic
--> long press button -> burst mode
so it's like the camera button ^^

<TaskerData sr="" dvi="1" tv="4.4u2m">
<Task sr="task3">
<cdate>1407020681604</cdate>
<edate>1407189977734</edate>
<id>3</id>
<nme>BT CAM MULTI SHUTTER</nme>
<pri>10</pri>
<Action sr="act0" ve="6">
<code>123</code>
<Str sr="arg0" ve="3">input touchscreen swipe 1090 300 1091 301 5000</Str>
<Int sr="arg1" val="0"/>
<Int sr="arg2" val="1"/>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
</Action>
</Task>
</TaskerData>
 

Attachments

Last edited:
  • Like
Reactions: TheEndHK

ovgandroid

Senior Member
Apr 11, 2012
76
5
0
Hm, didn't try that app, but this could help you:
https://play.google.com/store/apps/details?id=com.kober.headset&hl=de

I think, your headset has only one button so this button is for answering calls. Perhaps try also long pressing this button...
The good thing in this app: it can use also Tasker profiles/tasks...
Give it a try...

@TheEndHK:

Huh? Okay...
So I'll try a trick... ;) I cannot test it, cause I've disabled burst mode in some Xposed module and didn't find the option to enable it again, so please report if this thing works:

I think, longpress at touchscreen at camera button should also result into a burst shooting, so here we go.
This task will emulate a minimal swipe at the camera button --> long press.
So, default long press is set to 5000ms = 5secs...

All you have to do: Import this task, and add a new trigger (vol up/down) to start this task and report back...
BTW: U can also set the pause/play LONGPRESS trigger, just enable "Held down" at button trigger "Media Button".

--> short press button-> single pic
--> long press button -> burst mode
so it's like the camera button ^^
Searches always brought me to this app too but I tested and it seems to only support wired headsets ?