๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๊ณณ๊ฐ„์—์„œ ์ธ์‹ฌ๋‚œ๋‹ค/์‹ค๋ฌด

[Android] intent ๊ฐ’ ํŒŒ์‹ฑ ์ค‘ '+'๊ฐ€ ' '๋กœ ์น˜ํ™˜๋˜๋Š” ์ด์Šˆ ๋Œ€์‘

 

์ฐธ๊ณ 

https://dkrnfls.tistory.com/137

 

Android Uri.getQueryParameter์— + ๋“ค์–ด๊ฐ€๋ฉด ๋นˆ์นธ์œผ๋กœ ๋ฐ”๋€๋‹ˆ๋‹ค.

์ตœ๊ทผ์— ๋‹ค์ด๋‚˜๋ฏน๋งํฌ๋ฅผ ๊ตฌํ˜„ํ•˜๋˜์ค‘ ์ •๋ณด๋ฅผ ๋งํฌ์— query๋กœ ๋‹ด์•˜์„๋•Œ +๊ฐ€ ๋นˆ์นธ์œผ๋กœ ๋ณ€๊ฒฝ๋˜๋Š” ์ด์Šˆ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ™์€ ๋‹ค์ด๋‚˜๋ฏน ๋งํฌ๋ฅผ ๊ณต์œ ํ–ˆ์„๋•Œ ios์—์„œ๋Š” ์ด์Šˆ๊ฐ€ ์—†์–ด์„œ ์•ˆ๋“œ๋กœ์ด๋“œ ์ชฝ์˜ ์ด์Šˆ

dkrnfls.tistory.com

 

์ด์Šˆ

๋”ฅ๋งํฌ ์ž‘์—… ์ค‘์—

 

๋‹ค์Œ๊ณผ ๊ฐ™์ด intent๋ฅผ ๋ฐ›์•„์™”๋‹ค.
intent action: android.intent.action.VIEW / data : something://action?authorize=0id4gzmDNXhJY9xbNsOYpbg/rLuhKEc2zyWwZ+7s6YF9Pju8hVErS8Pshsi+ugWPrPW1pieHA2mrzSMKOifAWgaQV4w=
 
๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ ๊ฐ’์„ ๊ตฌํ–ˆ๋Š”๋ฐ, '+' ๊ฐ’์ด ' '์ด๋Ÿฐ ๊ณต๋ฐฑ์œผ๋กœ ์ฑ„์›Œ์ ธ์„œ ๊ฐ’์„ ๋ฐ›์•˜๋‹ค.
val uri = intent.data 
val authorizeCode = uri.getQueryParameter("authorize")

 

 

๋‚ด๊ฐ€ ์›ํ•˜๋Š” ๊ฒฐ๊ณผ authorizedCode ๊ฐ’

0id4gzmDNXhJY9xbNsOYpbg/rLuhKEc2zyWwZ+7s6YF9Pju8hVErS8Pshsi+ugWPrPW1pieHA2mrzSMKOifAWgaQV4w=

 

์‹ค์ œ ๊ฐ’

0id4gzmDNXhJY9xbNsOYpbg/rLuhKEc2zyWwZ 7s6YF9Pju8hVErS8Pshsi ugWPrPW1pieHA2mrzSMKOifAWgaQV4w=

 

ํ•ด๊ฒฐ

Uri.getQueryParameter() ๋Œ€์‹  Uri.getQueryParameters()๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

https://dkrnfls.tistory.com/137

 

Android Uri.getQueryParameter์— + ๋“ค์–ด๊ฐ€๋ฉด ๋นˆ์นธ์œผ๋กœ ๋ฐ”๋€๋‹ˆ๋‹ค.

์ตœ๊ทผ์— ๋‹ค์ด๋‚˜๋ฏน๋งํฌ๋ฅผ ๊ตฌํ˜„ํ•˜๋˜์ค‘ ์ •๋ณด๋ฅผ ๋งํฌ์— query๋กœ ๋‹ด์•˜์„๋•Œ +๊ฐ€ ๋นˆ์นธ์œผ๋กœ ๋ณ€๊ฒฝ๋˜๋Š” ์ด์Šˆ๊ฐ€ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ™์€ ๋‹ค์ด๋‚˜๋ฏน ๋งํฌ๋ฅผ ๊ณต์œ ํ–ˆ์„๋•Œ ios์—์„œ๋Š” ์ด์Šˆ๊ฐ€ ์—†์–ด์„œ ์•ˆ๋“œ๋กœ์ด๋“œ ์ชฝ์˜ ์ด์Šˆ

dkrnfls.tistory.com

 

https://developer.android.com/reference/android/net/Uri#getQueryParameters(java.lang.String)

 

Uri  |  Android Developers

 

developer.android.com

 

 

val uri = intent.data 
val authorizeCode : List<String> = uri.getQueryParameters("authorize")