title: How to cast LifecycleOwner on Service class?
body: <p>I want to select data on room database with livedata from service class. How to cast the LifecycleOwner when observe it?</p>
  
  <pre><code>repositoryDatabase.getTimeline().observe(this, timelineList -&gt; {
      if (timelineList != null &amp;&amp; timelineList.size() &gt;= 10) {
          JSONArray arrayTimeline = new JSONArray();
          for (TimelineEntity timeline : timelineList) {
              JSONObject objectTimeline = new JSONObject();
              try {
                  objectTimeline.put("doku", timeline.getIdDokumen());
                  objectTimeline.put("entrydate", timeline.getEntryDate());
                  objectTimeline.put("lat", timeline.getLat());
                  objectTimeline.put("lng", timeline.getLng());
  
                  arrayTimeline.put(objectTimeline);
              } catch (JSONException e) {
                  e.printStackTrace();
              }
          }
          onUpdateLocation(arrayTimeline.toString());
      }
  });
  </code></pre>