DeepLink를 사용하는 이유는 검색엔진과 IT회사들에게 ‘모바일 컨텐츠 = 트래픽 = 수익’ 인데, 검색 및 인덱싱이 불가능한 컨텐츠가 많아지면서 모바일 컨텐츠 역전 현상에 대비하기 위한 것이다. 즉, 웹과 앱이 유기적으로 연결이 되어서 해당앱에 오래 머물도록 유도하기 위함이라 할 수 있다. 첫번째로 봐야할건 ‘AndroidManifest.xml’ 이다. ACTION_VIEW를 추가하는 것은 Google에서 앱 컨텐츠를 크롤링하고 사용자가 검색 결과에서 앱을 입력할 수 있게 해주는 작업이라 할 수 있다. 부분이 커스텀 스키마이며, 사용자가 지정한 스키마의 값을 가지고 특정 액티비티를 호출할 수 있다. 웹이나 앱에서 다 호출이 가능하며 ‘scheme:://host’ 같은 uri 형태로 액티비티를 호출할..

0. Subject RxJava에서 Subject 클래스는 구독하고 있는 관찰자(Observer)에게 새로운 값을 전달 할 때 사용하는 클래스다. 따로 Observable로 새로운 값을 만들 필요 없이 Subject 객체에 내장된 onNext 함수로 새로운 값을 옵저버에게 전달할 수 있기 때문에 짧은 코드로도 reactive하게 구현하는 것이 가능하다. 안드로이드에서 제공하는 LiveData와 유사한 역할을 한다. 아래 코드는 Subject 클래스중 하나인 PublishSubject를 이용해서 새로운 값을 갱신하는 예제다. class Person { var publishName: PublishSubject = PublishSubject.create() } val person = Person() perso..
Room 은 메인쓰레드에서 db 의 접근을 허용하지 않는다. 허용하려면 allowMainThreadQueries() 를 호출하면 되지만 권장하지 않는다. 그래서 LiveData, AsyncTask, RxJava 를 함께 사용해야 한다. 1편에서는 AsyncTask 를 이용한 Room 사용방법을 알아보겠다. Cart @Entity(tableName = "cart.db") public class Cart { @PrimaryKey(autoGenerate = true) public int uid; @ColumnInfo(name = "id") public int id; @ColumnInfo(name = "name") public String name; @ColumnInfo(name = "price") public..
Retrofit2 를 이용해서 POST 를 하고자 할때 크게 3가지 방법이 있다. 1. @Part - @Part 는 파일을 POST 할때 쓰인다(이미지라 가정하고 작성) - @Part 를 사용하려면 @MultiPart 도 함께 써야한다. @Multipart @POST("picture/upload") Call postImage(@Part("key") RequestBody key, @Part("id") RequestBody id, @Part("name") RequestBody name, @Part MultipartBody.Part image); private void uploadImage(String mKey, int mId, String mName) { File file = new File(이미지 경로);..
서버쪽에서 등록한 이미지를 Api 로 받고 쇼핑몰 광고 배너처럼 자동 슬라이드 될 수 있도록 해보자 * activity_brand (Layout) * Retrofit2 : ClientClass, ServiceClass 만들기(코드 생략) * BannerResponse & Banner (api model) public class BannerResponse { private List result; public List getResult() { return result; } public void setResult(List result) { this.result = result; } public static class Banner { private int id; private String image; publi..

JAVA에서 기본적인 자료 구조를 제공하기 위한 환경을 JAVA Collection Framework라고 한다. 다음은 JAVA Collection Framework의 상속 기본 구조이다. Collection Collection 인터페이스를 상속받아 List와 Set 인터페이스가 된다. List는 순서가 있는 Collection, 그리고 List는 Data 중복을 허락한다. 하지만 Set은 순서의 의미가 없으며 Data를 중복해서 포함할 수 없다. List 인터페이스의 특징 순서가 있는 Collection.(이 순서는 삽입된 순서를 의미한다.) Data를 중복해서 포함할 수 있다. Stack의 특징 Data의 삽입과 추출이 후입선출(Last-In First-Out) 구조로 되어 있다. push() met..
1. BootReceiver class 를 만들고 BroadcastReceiver 상속 첫화면으로 띄우고 싶은 class 를 intent 에 담아서 실행 import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { Intent intent = new Inte..
1. drawable/circle_progressbar 을 만들어주자 2. progressbar 설정 android:indeterminateDuration="1000" 원이 돌아가는 속도값 3. View 설정 visible, gone, invisible 을 활용하여 사용 private ProgressBar progressBar; progressBar = v.findViewById(R.id.progress_bar); progressBar.setVisibility(View.VISIBLE);
3. 앞서서 얻은 FILE 을 Retrofit2 를 사용하여 서버에 POST 해보자 public class ApiClient { public static Retrofit getClient() { retrofit = new Retrofit.Builder() .baseUrl("URL") .addConverterFactory(GsonConverterFactory.create()) .build(); return retrofit; } } public interface ApiService { @Multipart @POST("endPoint") Call postImage(@Part("id") RequestBody id, @Part MultipartBody.Part image); } public class ImageR..
1. GLSurfaceView 캡처 → Bitmap 변환 private Bitmap shareBitmap; private Bitmap tempBitmap; private GLSurfaceView mSurfaceView; private ImageView iv_capture; private interface BitmapReadyCallbacks { // callback void onBitmapReady(Bitmap bitmap); } // 얘를 실행하면 캡처 private void captureGLSurface() { captureBitmap(new BitmapReadyCallbacks() { @Override public void onBitmapReady(Bitmap bitmap) { iv_capture...