You need some kind of backend server. It remains same for iOS and android. usually you will make an async request to server, with username and password, and server will reply if user is authenticated or not. (server will check username and password and reply with true or false). This mechanism applies to iOS as well as android.
You can use
- Firebase Authentication Check Here
- Custom Backend Server(using PHP or Node etc)
- There are so many other options to choose from for your backend
Regarding your question
Also what happens if the user is still logged in into the iOS app but
wants to use the app on Android?
You should allow user to be logged Into ONE device AT A time. For this, there is a concept of Session Management.
When you send a request to your backend server. It can generate an auth token. Then you will need to send auth token with each API request.
Now imagine user logged into your app on android. server generated a token and sent it back to android. Android app saved the token. Now when user logs into iOS, a new token will be generated. previous token will be invalidated and when android app sends a request with expired token, server will not send response.
See this answer for a general concept of session management.
Hope it helps. Let me know if you need further clarifications
Now