I tried making an app that converts a website into a android studio app. The website I tried to convert have 2 parts to it: a "blog" and a ecommerce shop. To access the shop you NEED to log in, you can't access it otherwise. When trying to log in from the emulators google browser it works, but not from the app. I tried converting amazon to app and it works. What can I do?
This is where it gets stuck:
package com.ca.prosol.ui.gallery;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ProgressBar;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import com.ca.prosol.databinding.FragmentGalleryBinding;
public class GalleryFragment extends Fragment {
private FragmentGalleryBinding binding;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
GalleryViewModel galleryViewModel =
new ViewModelProvider(this).get(GalleryViewModel.class);
binding = FragmentGalleryBinding.inflate(inflater, container, false);
View root = binding.getRoot();
final WebView contributeWebView = binding.idWebViewContribute;
final ProgressBar loadingPB = binding.idPBLoading;
WebSettings webSettings = contributeWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
contributeWebView.setWebChromeClient(new WebChromeClient());
contributeWebView.loadUrl("https://shop.prosol.ca/login"); // this is the website that's being accessed
contributeWebView.setWebViewClient(new WebViewClient(){
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
loadingPB.setVisibility(View.VISIBLE);
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
loadingPB.setVisibility(View.GONE);
}
});
contributeWebView.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if(event.getAction()==KeyEvent.ACTION_DOWN){
switch (keyCode){
case KeyEvent.KEYCODE_BACK:
if(contributeWebView.canGoBack()){
contributeWebView.goBack();
}
}
}
return false;
}
});
return root;
}
@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}
I tried making an app that converts a website into a android studio app. The website I tried to convert have 2 parts to it: a "blog" and a ecommerce shop. To access the shop you NEED to log in, you can't access it otherwise. When trying to log in from the emulators google browser it works, but not from the app. I tried converting amazon to app and it works. What can I do? This is where it gets stuck:![Capture](https://github.com/boncey/Flickr4Java/assets/73304677/ebd50cae-fb6e-4740-897d-a11d4fead42e)