Skip to content

Commit

Permalink
New test for deeplinking
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandar.marinkovi committed Aug 11, 2021
1 parent 5bb749f commit b4ba7d7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
10 changes: 10 additions & 0 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@
<activity android:name=".MediaActivityExample" />
<activity android:name=".VideoActivity" />
<activity android:name=".MainActivity">


<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
<data android:scheme="mapptest" android:host="test" />
<!-- note that the leading "/" is required for pathPrefix-->
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,21 @@
package com.example.webtrekk.androidsdk

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.appoxee.Appoxee
import com.example.webtrekk.androidsdk.mapp.MainActivity
import kotlinx.android.synthetic.main.activity_main.*
import webtrekk.android.sdk.*
import java.lang.StringBuilder

@TrackPageDetail(
contextName = "Main Page",
trackingParams = [TrackParams(paramKey = Param.PAGE_PARAMS.INTERNAL_SEARCH, paramVal = "search")]
trackingParams = [TrackParams(
paramKey = Param.PAGE_PARAMS.INTERNAL_SEARCH,
paramVal = "search"
)]
)
class MainActivity : AppCompatActivity() {

Expand Down Expand Up @@ -86,5 +91,18 @@ class MainActivity : AppCompatActivity() {
val intent = Intent(this, ObjectTrackingActivityExample::class.java)
startActivity(intent)
}

val int = intent
val uri = int.data
if (uri != null) {
val result = int.dataString?.removePrefix("mapptest://test?link=")
val url = Uri.parse(result)
Webtrekk.getInstance().trackUrl(url)
Webtrekk.getInstance().trackPage(this)
}
}

override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
}
}

0 comments on commit b4ba7d7

Please sign in to comment.