- 다른 액티비티 시작
val intent = Intent(this, AnotherActivity::class.java)
startActivity(intent)
- 액티비티 시작 및 데이터 전달
val intent = Intent(this, AnotherActivity::class.java)
intent.putExtra("key", "value")
startActivity(intent)
- 웹페이지 열기
val webpage = Uri.parse("http://www.example.com")
val intent = Intent(Intent.ACTION_VIEW, webpage)
startActivity(intent)
- 전화 걸기
val phoneNumber = Uri.parse("tel:123456789")
val intent = Intent(Intent.ACTION_DIAL, phoneNumber)
startActivity(intent)
- 암시적 인텐트로 다른 앱에서 기능 실행
val intent = Intent(Intent.ACTION_SEND)
intent.type = "text/plain"
intent.putExtra(Intent.EXTRA_TEXT, "Hello, this is a message!")
startActivity(intent)
- 서비스 시작
val serviceIntent = Intent(this, MyService::class.java)
startService(serviceIntent)
- 브로드캐스트 메시지 보내기
val intent = Intent("custom.action.MY_ACTION")
intent.putExtra("key", "value")
sendBroadcast(intent)