radimkliment / Service
0 喜歡
0 分支
4 檔案
最後活躍 1 hour ago
Implementation of service, bounded service in Android
| 1 | // without bound |
| 2 | override fun onStart() { |
| 3 | super.onStart() |
| 4 | val intent = Intent(this, HelloService::class.java) |
| 5 | startService(intent) |
| 6 | } |
| 7 | |
| 8 | // with bound |
| 9 | private lateinit var mService: LocalService |
| 10 | private var mBound: Boolean = false |
radimkliment / BroadcastReceiver
0 喜歡
0 分支
4 檔案
最後活躍 1 hour ago
Implementation of broadcast receivers: implicit, explicit, static, dynamic
| 1 | public class MyBroadcastReceiver : BroadcastReceiver() { |
| 2 | override fun onReceive(context : Context, intent: Intent) { |
| 3 | |
| 4 | } |
| 5 | } |
| 6 | |
| 7 | BroadcastReceiver myBroadcastReceiver = new MyBroadcastReceiver(); |
| 8 | IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION); |
| 9 | filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED); |
上一頁
下一頁