hypweb.net
XOOPSマニア  最新情報のRSS(サイト全体)
[ 自宅サーバーWebRing |ID=54 前後5表示乱移動サイト一覧 ]

TOP » UsersWiki » nao-pon » blog » 2017-01-16

RSS of nao-pon/blog
2017 1月 16 (月)
 

LINE の通知音の鳴り分けを Tasker でやってみた anchor.png

超〜〜久々にブログ書いてみようかな。 :hammer:

昨年の年末31日に家族5台分のスマホを MNP でソフトバンクからドコモへ移りました。

スマホの内訳は iPhone 6S 64GB が 4台と Xperia X Perfomance が 1台でいずれも一括0円でした。Xperia は自分のです。実は XZ も一括0円でしたが、サイズ感とMicroUSBを選択して XP にした変わり者です。 :-D

と、前置きはこのぐらいにしてタイトルの件です。

LINE の通知音の鳴り分けをしたくて、Android アプリの Tasker を使って実現してみました。

Profile: LINE通知
 Event: Notification [ Owner Application:LINE Title:* Text:* Subtext:* Other Text:* Cat:* New Only:Off ]
Enter: LINE鳴り分け
 A1: Variable Set [ Name:%title To:%NTITLE Recurse Variables:Off Do Maths:Off Append:Off ]
 A2: Flash [ Text:%title Long:Off ]
 A3: Variable Set [ Name:%sound To:0 Recurse Variables:Off Do Maths:Off Append:Off ]
 A4: Variable Set [ Name:%sound To:-1 Recurse Variables:Off Do Maths:Off Append:Off ] If [ %title eq LINE ]
 A5: Variable Set [ Name:%sound To:1 Recurse Variables:Off Do Maths:Off Append:Off ] If [ %title ~ 太郎* | %title ~ 次郎* ]
 A6: Play Ringtone [ Type:Notification Sound:Procyon Stream:5 ] If [ %sound eq 1 ]
 A7: Play Ringtone [ Type:Notification Sound:Ray Stream:5 ] If [ %sound eq 0 ]
  • LINE の通知をトリガーにしてタスクを設定します。
  • 通知のタイトルをローカル変数 %title に保存します。
  • デフォルトの通知音用にローカル変数 %sound に 0 をセットします。
  • 太郎さんと次郎さんの通知音のみ特別なものにするため %sound に 1 をセットします。前方一致とするためにワイルドカード * を追加しています。
  • グループトークの通知は、どうやら 2回トリガーされるらしく、タイトルが "LINE" の場合は無視するために %sound に -1 をセットします。
  • %sound = 0 と 1 の通知音を鳴らします。

Tasker で通知音をならすため、ラインアプリ自体の通知音は無効にしておかないと、2重に通知音が鳴ります。

とこんなところです。ラインアプリで通知音鳴り分けを設定できればこんな面倒なことしなくても済むのにね :laught:

XML も置いときます。

fileLINE通知鳴り分け.xml
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<taskerdata sr="" dvi="1" tv="4.9u3m">
    <profile sr="prof56" ve="2">
        <cdate>
            1484378254333
        </cdate>
        <edate>
            1484570390541
        </edate>
        <id>
            56
        </id>
        <mid0>
            55
        </mid0>
        <nme>
            LINE通知
        </nme>
        <event sr="con0" ve="2">
            <code>
                461
            </code>
            <app sr="arg0">
                <appclass>
                    jp.naver.line.android.activity.SplashActivity
                </appclass>
                <apppkg>
                    jp.naver.line.android
                </apppkg>
                <label>
                    LINE
                </label>
            </app>
            <str sr="arg1" ve="3">
            </str>
            <str sr="arg2" ve="3">
            </str>
            <str sr="arg3" ve="3">
            </str>
            <str sr="arg4" ve="3">
            </str>
            <str sr="arg5" ve="3">
                <int sr="arg6" val="0">
                </int>
            </str>
        </event>
    </profile>
    <task sr="task55">
        <cdate>
            1484377764924
        </cdate>
        <edate>
            1484570390541
        </edate>
        <id>
            55
        </id>
        <nme>
            LINE鳴り分け
        </nme>
        <action sr="act0" ve="7">
            <code>
                547
            </code>
            <str sr="arg0" ve="3">
                %title
            </str>
            <str sr="arg1" ve="3">
                %NTITLE
            </str>
            <int sr="arg2" val="0">
            </int>
            <int sr="arg3" val="0">
            </int>
            <int sr="arg4" val="0">
            </int>
        </action>
        <action sr="act1" ve="7">
            <code>
                548
            </code>
            <str sr="arg0" ve="3">
                %title
            </str>
            <int sr="arg1" val="0">
            </int>
        </action>
        <action sr="act2" ve="7">
            <code>
                547
            </code>
            <str sr="arg0" ve="3">
                %sound
            </str>
            <str sr="arg1" ve="3">
                0
            </str>
            <int sr="arg2" val="0">
            </int>
            <int sr="arg3" val="0">
            </int>
            <int sr="arg4" val="0">
            </int>
        </action>
        <action sr="act3" ve="7">
            <code>
                547
            </code>
            <str sr="arg0" ve="3">
                %sound
            </str>
            <str sr="arg1" ve="3">
                -1
            </str>
            <int sr="arg2" val="0">
            </int>
            <int sr="arg3" val="0">
            </int>
            <int sr="arg4" val="0">
                <conditionlist sr="if">
                    <condition sr="c0" ve="3">
                        <lhs>
                            %title
                        </lhs>
                        <op>
                            0
                        </op>
                        <rhs>
                            LINE
                        </rhs>
                    </condition>
                </conditionlist>
            </int>
        </action>
        <action sr="act4" ve="7">
            <code>
                547
            </code>
            <str sr="arg0" ve="3">
                %sound
            </str>
            <str sr="arg1" ve="3">
                1
            </str>
            <int sr="arg2" val="0">
            </int>
            <int sr="arg3" val="0">
            </int>
            <int sr="arg4" val="0">
                <conditionlist sr="if">
                    <bool0>
                        Or
                    </bool0>
                    <condition sr="c0" ve="3">
                        <lhs>
                            %title
                        </lhs>
                        <op>
                            2
                        </op>
                        <rhs>
                            太郎*
                        </rhs>
                    </condition>
                    <condition sr="c1" ve="3">
                        <lhs>
                            %title
                        </lhs>
                        <op>
                            2
                        </op>
                        <rhs>
                            次郎*
                        </rhs>
                    </condition>
                </conditionlist>
            </int>
        </action>
        <action sr="act5" ve="7">
            <code>
                192
            </code>
            <int sr="arg0" val="1">
                <str sr="arg1" ve="3">
                    Procyon
                </str>
            </int>
            <int sr="arg2" val="5">
                <conditionlist sr="if">
                    <condition sr="c0" ve="3">
                        <lhs>
                            %sound
                        </lhs>
                        <op>
                            0
                        </op>
                        <rhs>
                            1
                        </rhs>
                    </condition>
                </conditionlist>
            </int>
        </action>
        <action sr="act6" ve="7">
            <code>
                192
            </code>
            <int sr="arg0" val="1">
                <str sr="arg1" ve="3">
                    Ray
                </str>
            </int>
            <int sr="arg2" val="5">
                <conditionlist sr="if">
                    <condition sr="c0" ve="3">
                        <lhs>
                            %sound
                        </lhs>
                        <op>
                            0
                        </op>
                        <rhs>
                            0
                        </rhs>
                    </condition>
                </conditionlist>
            </int>
        </action>
    </task>
</taskerdata>


トップ   凍結 差分 バックアップ 複製 名前変更 リロード印刷に適した表示   ページ新規作成 全ページ一覧 単語検索 最新ページの一覧   ヘルプ   最新ページのRSS 1.0 最新ページのRSS 2.0 最新ページのRSS Atom Powered by xpWiki
Counter: 1334, today: 1, yesterday: 0
初版日時: 2017-01-16 (月) 21:46:27
最終更新: 2017-01-16 (月) 21:48:19 (JST) (2618d) by nao-pon
このページのTopへ
メインメニュー
ログイン

ユーザー名:


パスワード:





パスワード紛失  |新規登録
最近の更新
オンライン状況
180 人のユーザが現在オンラインです。 (10 人のユーザが UsersWiki を参照しています。)

登録ユーザ: 0
ゲスト: 180

もっと...
サイト情報