如果我的Xcode应用程序中的WebView有效,为什么它在我的Android应用程序中不起作用?

Today I started my first android app using "Android Studio". I have created a WebView app that displays a PHP scripts which has a HTML form with one input field and a submit button. Once the correct user code is entered the PHP script checks if the user code is correct. If correct opens another PHP script displaying data. At least that what it should do.

I already have a App written in Mac Xcode which works as expected and accessing the PHP using a browser works find.

The PHP script using PHP SESSION variables but the Android app does not seem to like them.

The problem seems to be related to how cookies are handled by Android's WebView.

By default, cookies are not enabled, therefore even if PHP tries to store the session_id, it cannot retrieve it later, and this causes a new session to start.

On SO you can find many answers that explain you how to enable cookies for WebView. See for example this one: How to enable cookies in Android WebView?.