ardayuce adlı üyeden alıntı: mesajı görüntüle
merhabalar wpde açmasını istiyorum anca bu şekilde yapıyor ve wpyi açmıyor. ben wpyi uygulamanın dışında direkt wp olarak açmasını istiyorum







package com.jamillabltd.bottomnavigationwebview.BottomFragments;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.ProgressBar;

import com.jamillabltd.bottomnavigationwebview.R;

public class MessageFragment extends Fragment {
String webUrlMessage = "https://api.whatsapp.com/send/?phone=90xxxxxxxxxx&text&type=phone_number&app_absent=0";
private ProgressBar progressBar;
private FrameLayout webView_container;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_message, container, false);
}

@SuppressLint("SetJavaScriptEnabled")
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

//initialize webView - JavaScript Enable - load url
WebView mWebView = view.findViewById(R.id.webViewId);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl(webUrlMessage);

progressBar = view.findViewById(R.id.progress_bar);
// Find the FrameLayout and set it to mLayout
webView_container = view.findViewById(R.id.webView_container_id);

mWebView.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// Show the progress bar when the page starts loading
progressBar.setVisibility(View.VISIBLE);
webView_container.setAlpha(0.5f);
}
@Override
public void onPageFinished(WebView view, String url) {
// Hide the progress bar when the page finishes loading
progressBar.setVisibility(View.GONE);
webView_container.setAlpha(1.0f);
}
});

}
}

Kodlarını inceledigimde sayfa yüklenir fakat whatsapp web bunu Özel URL Şeması olarak algılar ve hata verir

WhatsApp ile entegre olmanın iki yolu vardır:
Özel bir URL şeması aracılığıyla
Android'in intent sistemi aracılığıyla.

Denedigim SDK
minSdkVersion 19
targetSdkVersion 30

implementation

implementation 'androidx.appcompat:appcompat:1.2.0'
//noinspection GradleCompatible
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'


biz burda intent işleyecez öncelikle

Kodlarını bu şekilde daha kısa ve öz güncelledim

public class MessageFragment extends Fragment {
String webUrlMessage = "https://api.whatsapp.com/send/?phone=90xxxxxxxxxx&text&type=phone_number&app_absent=0";
private ProgressBar progressBar;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_message, container, false);
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

Intent i = new Intent(Intent.ACTION_VIEW);
 i.setData(Uri.parse(webUrlMessage));
 startActivity(i);

progressBar = view.findViewById(R.id.progress_bar);


}
}
olarak degiştir progressBar kullanman gerekmez yinede sen bilirsin direk wp acilacagi icin bence gereksiz

intent tanımladık webView kullanmana gerek yok fragment_message butonu tıklandıgı zaman otomatik olarak belirledigin numaradaki whatsapp penceresi açılır uygulaman arka planda çalışmaya devam eder yanlız böyle birşey peki kişinin telefonunda whatsapp kurulu degilse ? onun içinde uygulama içinde paket taraması yapman gerek egerki wp kurulu degilse lütfen whatsapp yükleyin gibisinden mesaj vermesi gerekli onuda sen android studio resmi sitesinden kaynakları inceleyerek yap sordugun soruya istinaden kodlarını güncelledim denedim aktif çalışıyor