Changeset View
Changeset View
Standalone View
Standalone View
src/org/kde/kdeconnect/KdeConnectBroadcastReceiver.java
Show All 21 Lines | |||||
22 | 22 | | |||
23 | import android.content.BroadcastReceiver; | 23 | import android.content.BroadcastReceiver; | ||
24 | import android.content.Context; | 24 | import android.content.Context; | ||
25 | import android.content.Intent; | 25 | import android.content.Intent; | ||
26 | import android.net.ConnectivityManager; | 26 | import android.net.ConnectivityManager; | ||
27 | import android.net.wifi.WifiManager; | 27 | import android.net.wifi.WifiManager; | ||
28 | import android.util.Log; | 28 | import android.util.Log; | ||
29 | 29 | | |||
30 | public class KdeConnectBroadcastReceiver extends BroadcastReceiver | 30 | public class KdeConnectBroadcastReceiver extends BroadcastReceiver { | ||
31 | { | | |||
32 | 31 | | |||
33 | 32 | | |||
34 | public void onReceive(Context context, Intent intent) { | 33 | public void onReceive(Context context, Intent intent) { | ||
35 | 34 | | |||
36 | //Log.e("KdeConnect", "Broadcast event: "+intent.getAction()); | 35 | //Log.e("KdeConnect", "Broadcast event: "+intent.getAction()); | ||
37 | 36 | | |||
38 | String action = intent.getAction(); | 37 | String action = intent.getAction(); | ||
39 | 38 | | |||
40 | switch(action) { | 39 | switch (action) { | ||
41 | case Intent.ACTION_PACKAGE_REPLACED: | 40 | case Intent.ACTION_PACKAGE_REPLACED: | ||
42 | Log.i("KdeConnect", "UpdateReceiver"); | 41 | Log.i("KdeConnect", "UpdateReceiver"); | ||
43 | if (!intent.getData().getSchemeSpecificPart().equals(context.getPackageName())) { | 42 | if (!intent.getData().getSchemeSpecificPart().equals(context.getPackageName())) { | ||
44 | Log.i("KdeConnect", "Ignoring, it's not me!"); | 43 | Log.i("KdeConnect", "Ignoring, it's not me!"); | ||
45 | return; | 44 | return; | ||
46 | } | 45 | } | ||
47 | BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() { | 46 | BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() { | ||
48 | @Override | 47 | @Override | ||
Show All 27 Lines | 74 | case Intent.ACTION_SCREEN_ON: | |||
76 | BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() { | 75 | BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() { | ||
77 | @Override | 76 | @Override | ||
78 | public void onServiceStart(BackgroundService service) { | 77 | public void onServiceStart(BackgroundService service) { | ||
79 | service.onNetworkChange(); | 78 | service.onNetworkChange(); | ||
80 | } | 79 | } | ||
81 | }); | 80 | }); | ||
82 | break; | 81 | break; | ||
83 | default: | 82 | default: | ||
84 | Log.i("BroadcastReceiver", "Ignoring broadcast event: "+intent.getAction()); | 83 | Log.i("BroadcastReceiver", "Ignoring broadcast event: " + intent.getAction()); | ||
85 | break; | 84 | break; | ||
86 | } | 85 | } | ||
87 | 86 | | |||
88 | } | 87 | } | ||
89 | 88 | | |||
90 | 89 | | |||
91 | | ||||
92 | } | 90 | } |