• Tasker to stop Poweramp control for the headset while there is an incoming SMS


    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

  • 相关阅读:
    java 后台校验格式
    spring AOP 实现事务和主从读写分离
    【Day5】项目实战.CSDN热门文章爬取
    【Day5】3.反爬策略之模拟登录
    【Day5】2.反爬策略之代理IP
    【Day5】1.Request对象之Header伪装策略
    【Day4】5.Request对象之Http Post请求案例分析
    【Day4】4.Request对象之Get请求与URL编码
    【Day4】3.urllib模块使用案例
    【Day4】2.详解Http请求协议
  • 原文地址:https://www.cnblogs.com/shangdawei/p/4510933.html
Copyright © 2020-2023  润新知