Small improvement

pull/184/head
M66B 4 years ago
parent c69394e7b9
commit af0fde7cb3

@ -71,6 +71,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
private Network lastActive = null; private Network lastActive = null;
private boolean lastSuitable = false; private boolean lastSuitable = false;
private Handler handler;
private PowerManager.WakeLock wlOutbox; private PowerManager.WakeLock wlOutbox;
private TwoStateOwner owner = new TwoStateOwner("send"); private TwoStateOwner owner = new TwoStateOwner("send");
private List<Long> handling = new ArrayList<>(); private List<Long> handling = new ArrayList<>();
@ -86,6 +87,8 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
super.onCreate(); super.onCreate();
startForeground(Helper.NOTIFICATION_SEND, getNotificationService().build()); startForeground(Helper.NOTIFICATION_SEND, getNotificationService().build());
handler = new Handler();
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
wlOutbox = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, BuildConfig.APPLICATION_ID + ":send"); wlOutbox = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, BuildConfig.APPLICATION_ID + ":send");
@ -281,7 +284,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
if (Looper.myLooper() == Looper.getMainLooper()) if (Looper.myLooper() == Looper.getMainLooper())
_checkConnectivity(); _checkConnectivity();
else else
new Handler(Looper.getMainLooper()).post(new Runnable() { handler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
_checkConnectivity(); _checkConnectivity();

Loading…
Cancel
Save