博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Tasker to stop Poweramp control for the headset while there is an incoming SMS - frozen
阅读量:5813 次
发布时间:2019-06-18

本文共 4359 字,大约阅读时间需要 14 分钟。

If you usually like to use Poweramp or any other media player to enjoy the music with headset plugged, once you check the option “respond to headset button”, Poweramp will take care of your headset line controller instead, and if you are in the middle of playing a song while there is a sms message incoming? You are not able to press the button to listen to the sms message body, cause it would just pause/resume the song instead.

So what is the workaround?
Anyway, there is always another way out, right? Please proceed.

am force-stop packagename this linux command could force stop all process from this package

PM List Packages -------This Linux command will display all the apps installed on your phone

PM disable com.maxmpz.audioplayer -------this Linux command would disable the application including all process and service.

We may call it like frozen. Your device would not recognize this app like it has not been installed.
PM enable com.maxmpz.audioplayer ------this Linux command would enable the application to make the device recognizes this app has well installed.

Simply use tasker run shell with root for this command or you may use locale excute plugin for tasker if you prefer.

By the way, there is a better tool for you, it is secure settings for tasker.

After installed, you will find the option of package state(package manager for some other devices),

open this option, select the app of Poweramp, then you will see 3 options below for you to pick.
On, Off, Toggle.
I guess it might be much more convenient anyway.

Well, once the app has got frozen, it will not be able to control the headset button anymore.

At that time, you may press the headset button to listen to the incoming sms message body.

Profile 1:
Context 1: state-hardware-media button, button: next, Grab checked ------for android 2.2+, this option is available to grab the control priority for headset button if any other media player installed. PS. You better not pick “play” button, cause if you accidently click twice, it would fire to call back for your last phone call.
Context 2: state-app-unread text ----------this context is used to avoid the normal situation while there is no incoming sms, so tasker would not bother other media player to control the headset button.
Action: variable-variable set, name: %MEDIABUTTON, to On

Profile 2:
Context 1: event-phone-text received, type: sms ------- I have tested if using unread text as context, if you didn’t read the previous sms, and later there is another new message incoming, it would not fire.
Context 2: state-hardware, headset plugged
Action 1: plugin-secure settings, package state, poweramp set disable -----------in some othe android device, it could be package manager instead.
Action 2: task-wait 5 seconds -----------this action is to give secure settings enough time to carry on its job, since to do this would require root access.
Action 3: misc-say, text: you have got a new message from %SMSRN, press next button to listen, engine: default (if China user, please pick another TTS which supports Chinese.), stream: media
Action 4: task-wait 30 seconds until %MEDIABUTTON ~ On -------this step is to give you enough time to press the play button, if you didn’t, it will go activate poweramp on instead of saying the message body.
Action 5: task-If %MEDIABUTTON ~ On
Action 6: misc-say, text: %SMSRB, engine: default (if China user, please pick another TTS which supports Chinese.), stream: media
Action 7: variable-variable clear, name: %MEDIABUTTON -------this is to clear the variable value after done saying the message.
PS. You may add one more action here running sl4a script to mark current sms as read. So you don’t have to go back to the message inbox to clear wipe it off.
Action 8: task-goto, action number 10 -------this step is to pass through to activate poweramp after done saying the message
Action 9: task-else ---------if you didn’t press the play button in 30 seconds, this action would fire.
Action 10: plugin-secure settings, package state, poweramp set enable
Action 11: task-wait, 6 seconds
Action 12: plugin-autoshortcut, activity, select: com.maxmpz.audioplayer.StartupActivity -------I did try to use tasker load app, but it doesn’t work very well most of time.
PS. You may use wait 5 seconds, then Go home right there after action 8, optional for you.
Action 13: task-end If

转载地址:http://tpvbx.baihongyu.com/

你可能感兴趣的文章
由于无法创建应用程序域,因此未能执行请求。错误: 0x80070002 系统找不到指定的文件...
查看>>
新开的博客,为自己祝贺一下
查看>>
puppet任务计划
查看>>
【CQOI2011】放棋子
查看>>
采用JXL包进行EXCEL数据写入操作
查看>>
一周总结
查看>>
将txt文件转化为json进行操作
查看>>
线性表4 - 数据结构和算法09
查看>>
C语言数据类型char
查看>>
Online Patching--EBS R12.2最大的改进
查看>>
Binary Search Tree Iterator leetcode
查看>>
Oracle性能优化--DBMS_PROFILER
查看>>
uva-317-找规律
查看>>
Event事件的兼容性(转)
查看>>
我的2014-相对奢侈的生活
查看>>
zoj 2412 dfs 求连通分量的个数
查看>>
Java设计模式
查看>>
一文读懂 AOP | 你想要的最全面 AOP 方法探讨
查看>>
ndk制作so库,ndk-build不是内部或外部命令。。。的错误
查看>>
Spring Cloud 微服务分布式链路跟踪 Sleuth 与 Zipkin
查看>>