-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathKTrackReceiverService.cs
More file actions
56 lines (50 loc) · 1.58 KB
/
Copy pathKTrackReceiverService.cs
File metadata and controls
56 lines (50 loc) · 1.58 KB
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
using Android.Content;
using KTrackPlus.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KTrackPlus
{
[BroadcastReceiver(Enabled = true, Exported = false)]
internal class KTrackReceiverService : BroadcastReceiver
{
public enum KTrackServiceAction : sbyte
{
Stop = 0,
Start = 1,
StartMail = 2,
}
public override void OnReceive(Context? context, Intent? intent)
{
if (intent != null)
{
//var action = (KTrackServiceAction)intent.GetByteExtra("action", -1);
var action = Enum.Parse<KTrackServiceAction>(intent.Action);
switch (action)
{
case KTrackServiceAction.Start:
ClientManager.Get.Start();
break;
case KTrackServiceAction.Stop:
ClientManager.Get.Stop();
break;
case KTrackServiceAction.StartMail:
Console.WriteLine("Start with send mail");
ClientManager.Get.AskSendMail = true;
ClientManager.Get.Start();
break;
}
}
//if (ClientManager.Get.IsRunning)
//{
// ClientManager.Get.Stop();
//}
//else
//{
// ClientManager.Get.Start();
//}
}
}
}