vendredi 28 décembre 2018

Android emulator can't get api data threw frontend website

I have frontend and backend ready and working on localhost. I am displaying the frontend website threw the android emulator:

public class MainActivity extends AppCompatActivity {

    private WebView webview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        webview =(WebView)findViewById(R.id.webView);

        webview.setWebViewClient(new WebViewClient());
        webview.getSettings().setJavaScriptEnabled(true);
        webview.getSettings().setDomStorageEnabled(true);
        webview.setOverScrollMode(WebView.OVER_SCROLL_NEVER);
        webview.loadUrl("http://10.0.2.2:4200/mobile");

    }
}

enter image description here

The problem is that emulator can't get the data from database or send request to api to recieve the data so that it's not displayed. How it looks on a website: enter image description here Once again the problem is straight with emulator. I tried building the frontend in production mode with no success. Maybe I should declare special permission or sth like that.

Android Studio Error: enter image description here




Aucun commentaire:

Enregistrer un commentaire