2021년 3월 10일 수요일

[Android] Deeplink 를 android studio 에서 테스트 하기

  Run > Edit Configurations 


해서 

Launch -> URL(또는 deeplink?) -> 주소란에 tutsplus://deeplink 


물론 사전에 소스에서 인텐트필터로 위의 주소로 왔을떄 받아들일 준비를 해야한다.


    <activity android:name="com.example.matthew.deeplinks.LinkActivity" android:label="@string/title_activity_link"

        android:theme="@style/AppTheme.NoActionBar">

        <intent-filter>

            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />

            <category android:name="android.intent.category.DEFAULT" />


            <!-- URI tutsplus://deeplink -->

            <data android:scheme="tutsplus" android:host="deeplink"/>

            <!-- URI https://www.mydeeplink.com -->

            <data android:scheme="http" android:host="www.mydeeplink.com"/>

        </intent-filter>

    </activity>


그리고 title_activity_link 에서는 

 Intent in = getIntent();

Uri data = in.getData(); 

String x;

String y;

if (uri != null) {

  x = data.getQueryParameter("x"); // x = "1.2"

  y = data.getQueryParameter("y"); // y = "3.4"

}


또는

String deeplinkUrl = in.getDataString();

하면 딥링크를통해 왔는지 알수 있다.

Related Posts:

  • [Android] Thread, Callable, Executor(framework) 쓰레드 다루기최근 coroutine , rx 로 인해 쓰레드 체 관한 처리가 조금 쉬워지긴했다.그래도 옛날 소스들을 보면 java thread, Executor 또는 AsyncTask를 이용해서 만들어진게 많다.이중 주로 외부랑 httpd 통신할때 쓰면 Executor 에 대해 알아보자.그전에 어차피 나올용어로서 Callable 과 Runnable을 알아보자 1 2 3 4 5 6 7 8 9 10 1… Read More
  • Kotlin generic function sample import android.support.v7.app.AppCompatActivity import android.os.Bundle import android.content.Intent import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() { companion object … Read More
  • [Android] HILT 사용해보자. Spring 에서 서비스단의 클래스를 그냥 어노테이션으로 선언만하고 막쓰던것 처럼 DI해주는 Dagger 라는 라이브러리를 기반으로 안드로이드에서  HILT로 새로 내놓았다고함.Dagger + Android LifeCycle = HILT 라고 생각해도됨. 구글이 Hilt currently supports the following Android classes:App… Read More
  • Kotlin 코딩팁http://rockdrumy.tistory.com/1378?category=772380… Read More
  • [Android] Firebase 도입 & 간단 테스트(analytics, fcm)Firebase로 디비저장, 자료저장, 채팅기능, 푸쉬수신기능,분석기능 등 한다. 요즘 다한다.https://firebase.google.com/products-build#develop-products1.firebase 사이트에서 등록하고, 만들고 있고 있는 앱의 package이름을 입력하고, google-serivice.json 을 app폴더(현재프로젝터의  app폴더) 넣어준다.2.Pro… Read More

0 comments:

댓글 쓰기