Background service examples

kotlin · · 105 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Does anyone have a good link to an example / tutorial on making a background service using Kotlin on Android? I&#39;m new to Kotlin and trying to figure out how to make my app poll a website, when the app is not in the foreground, every hour to check for post updates, and if an update if found to notify the user.</p> <p>Thanks!</p> <hr/>**评论:**<br/><br/>sebaslogen: <pre><p>Here is a Kotlin example, but you can just follow the JobScheduler guide in this medium blogpost:</p> <p><a href="https://github.com/googlesamples/android-jobscheduler">https://github.com/googlesamples/android-jobscheduler</a></p> <p><a href="https://medium.com/google-developers/scheduling-jobs-like-a-pro-with-jobscheduler-286ef8510129">https://medium.com/google-developers/scheduling-jobs-like-a-pro-with-jobscheduler-286ef8510129</a></p></pre>saldous: <pre><p>Thank you!</p></pre>0rpheu: <pre><p>You can create a <a href="https://developer.android.com/reference/android/app/job/JobService.html" rel="nofollow">jobService</a> and use a <a href="https://developer.android.com/reference/android/app/job/JobInfo.Builder.html" rel="nofollow">jobInfo</a> to set your repeating criteria.</p></pre>TotesMessenger: <pre><p>I&#39;m a bot, <em>bleep</em>, <em>bloop</em>. Someone has linked to this thread from another place on reddit:</p> <ul> <li>[<a href="/r/androiddev" rel="nofollow">/r/androiddev</a>] <a href="https://www.reddit.com/r/androiddev/comments/83f74x/background_service_examples_kotlin/" rel="nofollow">Background service examples (Kotlin)</a></li> </ul> <p> <em><sup>If you follow any of the above links, please respect the rules of reddit and don&#39;t vote in the other threads.</sup> <sup>(<a href="/r/TotesMessenger" rel="nofollow">Info</a></sup> <sup>/</sup> <sup><a href="/message/compose?to=/r/TotesMessenger" rel="nofollow">Contact</a>)</sup></em></p></pre>
105 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet