Android์์ Fragment๋ ๋ฌด์กฐ๊ฑด Java Code๋ก FragmentTransaction์ ํตํด ๋์ฐ๋ ๊ฑด ์ค ์์๋๋ฐ, ๊ฐ๋จํ XML๋ง์ผ๋ก๋ ๋์ธ ์ ์๋ ๋ฐฉ๋ฒ์ ์๊ฒ ๋์ด ๊ฐ๋จํ ์ ์ด ๋ณธ๋ค. 1. Fragment๋ฅผ ์์๋ฐ๋ Class๋ฅผ ์ ์ํ๋ค. public class DetailsFragment extends Fragment { @BindView(R.id.tv_title) TextView mTvTitle; public DetailsFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_details, container, false); ButterKnife.bind(this, root); return root; } } fragment_details.xml ์ ์๋ตํ๋ค. 2. ์์์ ์ ์ํ DetailsFragment๋ฅผ ์ ์ฌํ MainActivity์ layout xml ์ฝ๋๋ฅผ ์๋์ ๊ฐ์ด ์์ฑํ๋ค. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" t
Firebase Cloud Functions๋ฅผ ์ ์ฉํ๊ฒ ๋์๋ ๋ฐฐ๊ฒฝ์ ์ด์ ๊ธ์์ ์๊ฐํด๋๋ฆฐ ๋ฐ๊ฐ ์์ต๋๋ค. ๊ทธ ๊ธ์ ์ด์ด Cloud Functions ์ ์ฉ๊ธฐ๋ฅผ ๊ฐ๋จํ ์๊ฐํ๊ณ ์ ํฉ๋๋ค. ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. 1. Cloud Functions ๊ฐ๋ฐ ํ๊ฒฝ ๊ตฌ์ถ 2. Cloud Functions ์ฝ๋ ์์ฑ 3. Deploy ์ข๋ ์์ธํ ๋ด์ฉ์ ์ํ์๋ฉด ํ๊ธฐ ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ์๊ธฐ ๋ฐ๋๋๋ค. (๋ณธ ๊ธ์์ ๋ค๋ฃจ๋ ๋ด์ฉ๋ณด๋ค ์์ธํ ๋ด์ฉ์ ๋ด๊ณ ์์ต๋๋ค.) https://firebase.google.com/docs/functions/get-started https://firebase.google.com/docs/functions/database-events 1. Cloud Functions ๊ฐ๋ฐ ํ๊ฒฝ ๊ตฌ์ถ ๋จผ์ Cloud Functions์ ์์ํ๊ธฐ ์ํด์๋ ๋ณ๋ ๊ฐ๋ฐ ํ๊ฒฝ์ ๊ตฌ์ถํด์ผ ํฉ๋๋ค. Cloud Functions์ Node.js๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๋์ํ๋ ๊ฒ ๊ฐ์ต๋๋ค. ๋ฐ๋ผ์ ๋ค์ ๋จ๊ณ๊ฐ ์ ํ๋์ด์ผ ํฉ๋๋ค. Node.js ์ค์น (v6.11.1 recommend) npm ์ค์น Firebase CLI ์ค์น Node.js์ npm์ ์ค์นํ๋ค๋ฉด ๋ค์ ๋ช
๋ น์ด๋ก Firebase CLI๋ฅผ ์ค์นํ ์ ์์ต๋๋ค. npm install -g firebase-tools Firebase CLI๊น์ง ์ค์น๊ฐ ๋์๋ค๋ฉด ์ด์ Firebase Cloud Functions ํ๋ก์ ํธ๋ฅผ ์์ฑํด์ผ ํฉ๋๋ค. ์ ๊ฐ ๊ฐ๋ฐ ์ค์ธ ํ๋ก์ ํธ๋ Android ๋ชจ๋ฐ์ผ ์ดํ๋ฆฌ์ผ์ด์
์ด์์ต๋๋ค. ํ์ง๋ง ์ง๊ธ ์์ฑํ๊ณ ์ ํ๋ ์ฝ๋๋ Android ์ฑ์ด ์๋ Google Cloud ์๋ฒ์ ๋ก๋๋์ด ๋์ํ ์ฝ๋์ด๊ธฐ ๋๋ฌธ์ ๋ณ๋ ํ๋ก์ ํธ๋ฅผ ์์ฑํด์ผ ํฉ๋๋ค. 1.1 ๋จผ์ ๋ค์ ๋ช
๋ น์ด๋ฅผ ํตํด Firebase tool ์ฌ์ฉ์ ์ํ ์ธ์ฆ์ ์๋ฃํฉ๋๋ค. firebase login 1.2 ์ํ๋ ๊ฒฝ๋ก์ ์ํ๋ ์ด๋ฆ์ผ๋ก Directory๋ฅผ ์์ฑํ๊ณ , ๋ค์ ๋ช
๋ น์ด๋ก ์ด๊ธฐํํฉ๋๋ค.