Hello!
Im trying to get the daytime from internet.
I have tried it with an UnityWebRequest to"https://worldtimeapi.org/api/ip" and then parsing the json received.
I have tried it with a WebRequest to “https://www.google.com” and then parsing the time from response.Headers[“date”].
Both methods works on editor but not on Android.
As suggested in some forums I have checked Custom Main Manifest in Publishing settings and edited it adding android:usesCleartextTraffic=“true”> but it doesnt work, the error says “cannot resolve destination host”.
My AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.unity3d.player"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="preferExternal">
<application android:theme="@style/UnityThemeSelector"
android:icon="@mipmap/app_icon"
android:label="@string/app_name"
android:usesCleartextTraffic="true">
<activity android:name="com.unity3d.player.UnityPlayerActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
I have tried to implement a CertificateHandler as mentioned here
https://stackoverflow.com/questions/55112733/unitywebrequest-change-to-https
but it doesnt work either.
Could anybody help me please?
Unity 2021.3.14f1
Minimum API Level 33
Im using Google Movile Ads and Google Play Games, so there are more that one manifest file in the project but I guess Unity auto merge them on the build process isnt it?