●Tasker有無: 購入済み
●Androidバージョン:7
●root有無:なし
●やりたいこと
 カーナビにMHL接続してエンジン始動時に動画プレーヤーを自動スタートしエンジン切った時に自動オフにしたい。

エンジン始動及びオフ時に接続が不安定になる為、変数を使ってみたがうまく動かない。

Profile: POWER (3)
State: HDMI Plugged
Enter: Mhl Connected (4)
A1: Variable Set [ Name:%POWER To:1 Recurse Variables:Off Do Maths:On Append:Off ]

Exit: Mhl Disconnected (5)
A1: Variable Clear [ Name:%POWER Pattern Matching:On Local Variables Only:Off ]

Profile: MHL connected (15)
State: HDMI Plugged
Enter: Play Movie (14)
A1: Wait [ MS:0 Seconds:10 Minutes:0 Hours:0 Days:0 ]
A2: If [ %POWER = 1 ]
A3: Launch App [ App:MX Player Pro Data: Exclude From Recent Apps:Off Always Start New Copy:Off ] If [ %POWER = 1 ]
A4: Wait [ MS:500 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A5: Media Control [ Cmd:Play [Simulated Only] Simulate Media Button:On App:MX Player Pro ]
A6: Media Volume [ Level:15 Display:Off Sound:Off ]

Profile: MHL Disconnected (6)
State: Not HDMI Plugged
Enter: Power Off (12)
A1: Wait [ MS:0 Seconds:4 Minutes:0 Hours:0 Days:0 ]
A2: If [ %POWER != 1 ]
A3: Media Control [ Cmd:Pause Simulate Media Button:On App:MX Player Pro ]
A4: Go Home [ Page:0 ]
A5: System Lock If [ %POWER != 1 ]