Welcome to mirror list, hosted at ThFree Co, Russian Federation.

JobServiceDelegate.java « scheduling « maps « mapswithme « com « src « android - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 72d3aaca08d8eac5becb9fba47e5e58eccada50d (plain)
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
package com.mapswithme.maps.scheduling;

import android.app.Application;
import android.support.annotation.NonNull;

import com.mapswithme.maps.background.NotificationService;
import com.mapswithme.util.ConnectionState;

class JobServiceDelegate
{
  @NonNull
  private final Application mApp;

  JobServiceDelegate(@NonNull Application app)
  {
    mApp = app;
  }

  boolean onStartJob()
  {
    ConnectionState.Type type = ConnectionState.requestCurrentType();
    if (type == ConnectionState.Type.WIFI)
      NotificationService.startOnConnectivityChanged(mApp);

    retryJob();
    return true;
  }

  private void retryJob()
  {
    ConnectivityJobScheduler.from(mApp).listen();
  }

  boolean onStopJob()
  {
    return false;
  }
}