-1
People want to integrate my app with a support button when clicking it will open the Whatsapp through the url and open a Whatsapp chat with a specific support contact.
XML:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context=".action_suporte_whatsapp">
<WebView
android:id="@+id/action_suporte_whatsapp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true" />
</androidx.constraintlayout.widget.ConstraintLayout>
Java code:
package com.gennissi.gpstracking;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
public class action_suporte_whatsapp extends AppCompatActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
//codigo aqui
case R.id.action_suporte_whatsapp:
String url = "https://api.whatsapp.com/send?phone=" + getString(R.string.about_contact_what) + "&text=Solicito%20Suporte%20Aplicativo%20Ibi-System";
Intent intentSuporte = new Intent(Intent.ACTION_VIEW);
intentSuporte.setData(Uri.parse(url));
startActivity(intentSuporte);
return true;
}
return super.onOptionsItemSelected(item);
}
}
Could someone please help me?