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

Tasker to stop Poweramp control for the headset while there is an incoming SMS - frozen的更多相关文章

  1. Content portal for Pocketables Tasker articles

    http://www.pocketables.com/2013/03/overview-of-pocketables-tasker-articles.html I write a lot about ...

  2. 蓝牙技术 A2DP AVRCP BlueZ

    BlueZ 做为 linux 标准的协议栈,提供非常多的 profile ,各种的支持,ble , 蓝牙网络,文件传输,a2dp 音频传输. A2DP——Advanced Audio Distribu ...

  3. Android 权限列表

    访问登记属性 android.permission.ACCESS_CHECKIN_PROPERTIES ,允许读写check-in数据库属性表的权限 ( Allows read/write acces ...

  4. Android Permission 访问权限大全(转)

    程序执行需要读取到安全敏感项必需在androidmanifest.xml中声明相关权限请求, 完整列表如下: android.permission.ACCESS_CHECKIN_PROPERTIES允 ...

  5. 解决某些Android Permission denied

    最近遇到一个问题,总是在模拟器重报Permission denied错误,于是我直接在手机上测试,发现没有错误,于是很郁闷,反复在AndroidManifest中加入权限   <uses-per ...

  6. Android Permission中英对照

    android.permission.ACCESS_CHECKIN_PROPERTIESAllows read/write access to the "properties" t ...

  7. Android permission 访问权限大全

    程序执行需要读取到安全敏感项必需在androidmanifest.xml中声明相关权限请求, 完整列表如下: android.permission.ACCESS_CHECKIN_PROPERTIES ...

  8. Android manifest之系统自带的permission

    Android manifest之系统自带的permission 本文描述Android系统自带的permission.点击查看:“关于permission的原始定义和说明”.点击查看:“Androi ...

  9. Android权限列表permission说明

    网络上不乏android权限列表,但是很少有将列表和使用方法放在一起的,所以特此总结一下 需要在AndroidManifest.xml中定义相应的权限(以获取internet访问权限为例),如下: & ...

随机推荐

  1. AdvStringGrid 固定行、列

  2. Struts 2 Tutorial

    Apache Struts 2 is an elegant, extensible framework for creating enterprise-ready Java web applicati ...

  3. 彻底卸载sql2008后重新安装

    彻底卸载sql2008方法 --打开控制面板,在控制面板中卸载所有带sql server的程序. --删除C:\Program Files\Microsoft SQL Server这整个文件夹, -- ...

  4. MFC+WinPcap编写一个嗅探器之二(界面)

    选择新建->项目->MFC应用程序->基于对话框完成,这里文件名为sniffer 打开资源视图中的Dialog列表,打开项目总默认创建的话框,将对话框中的所有控件删除,之后按照最终效 ...

  5. Django实战(20):分页(Pagination)

    在上一节我们实现了针对某个产品的订单订阅功能.但是我们可能需要直接在站点上查询所有的订单.显然,随着时间的增长订单会越来越多,所以分页(Pagination)是个好办法:每次只显示一部分订单. 分页是 ...

  6. JSP的学习一(基础知识)

    一:介绍 1). WHY: JSP 是简 Servlet 编写的一种技术, 它将 Java 代码和 HTML 语句混合在同一个文件中编写, 只对网页中的要动态产生的内容采用 Java 代码来编写,而对 ...

  7. Spark入门1(以WordCount为例讲解flatmap和map之间的区别)

    package com.test import org.apache.spark.{SparkConf, SparkContext} object WordCount { def main(args: ...

  8. ThreadLocal和ThreadLocalMap源码分析

    目录 ThreadLocal和ThreadLocalMap源码分析 背景分析 定义 例子 源码分析 ThreadLocalMap源码分析 ThreadLocal源码分析 执行流程总结 源码分析总结 T ...

  9. 华为荣耀V8这个7.0的系统的root

    原文链接:http://m.shuaji.com/jiaocheng/5585.htm 已经有不少的机友的华为荣耀V8手机已经升级到EMUI5.0了,也就是现在的安卓7.0的系统,那这个时候该如何进行 ...

  10. Android四大组件-服务

    Android服务 android 的服务有点类似windows的服务,没有界面,在后台长时间运行,如果我们这种需求的话我们就可以使用服务来实现. 服务的典型应用场景: 播放音乐,下载等,如果要在一个 ...