With This, you will see a floating chat icon in your app
Now we need to open the chat window with the click of the floating chat icon.
but before that, we need to create a web view for the opening window
Step 3: Create A new Activity and layout with webview
<WebView
android:id="@+id/webViewNext"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.webkit.WebSettings
import android.webkit.WebView
class NextWebViewActivity : AppCompatActivity() {
private lateinit var webViewNext: WebView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_next_web_view)
// Find the WebView by its ID
webViewNext = findViewById(R.id.webViewNext)
// Configure WebView settings
val webSettings: WebSettings = webViewNext.settings
webSettings.javaScriptEnabled = true // Enable JavaScript (optional)
// Load a URL in the WebView
webViewNext.loadUrl("your URL from sale assist dashboard")
}
}
Step4: Setup Touch Event with the floating chat icon
val touchView: View = findViewById(R.id.touchView)
touchView.setOnClickListener {
// Add your action here
// For example, navigate to another activity
val intent = Intent(this, NextWebViewActivity::class.java)
startActivity(intent)
}