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 boolean lastSuitable = false;
private Handler handler;
private PowerManager.WakeLock wlOutbox;
private TwoStateOwner owner = new TwoStateOwner("send");
private List<Long> handling = new ArrayList<>();
@ -86,6 +87,8 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
super.onCreate();
startForeground(Helper.NOTIFICATION_SEND, getNotificationService().build());
handler = new Handler();
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
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())
_checkConnectivity();
else
new Handler(Looper.getMainLooper()).post(new Runnable() {
handler.post(new Runnable() {
@Override
public void run() {
_checkConnectivity();

Loading…
Cancel
Save