Android application not connecting to Wifi ,but wo

2019-03-16 17:41发布

问题:

Hi, I am not able to understand why my android application does not work when it accesses the internet through WiFi. The application is able to work when it uses its own 3G connection. It doesn't connect to WIFI. But if I share my 3g connection which i have in my iPhone through WiFi (tethering) the android device can access the server. I checked the application in various devices, and changed the manifest as follows, still no response.
The code that doesn't connect is a login page. I followed normal php script,but it not connecting to that script in WiFi,

Thanks in advance

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="cs.nott.ac.uk.app"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" />

    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <uses-feature android:name="android.hardware.wifi" />

    <supports-screens
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true"
        android:xlargeScreens="true" />

    <application
        android:icon="@drawable/launch"
        android:label="@string/app_name" >
        <activity
            android:name=".activities.LoginActivity"
            android:clearTaskOnLaunch="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".activities.MainActivity"
            android:clearTaskOnLaunch="true" >
        </activity>
        <activity android:name=".activities.qr.RefresherActivity" >
        </activity>
        <activity android:name=".activities.SummaryActivity" >
        </activity>
        <activity android:name=".activities.management.ManagementandReflection" >
        </activity>
        <activity android:name=".activities.qr.QR_MaterialActivity" >
        </activity>
        <activity android:name=".activities.qr.Starting_offActivity" >
        </activity>
        <activity android:name=".activities.qr.DifferentialActivity" >
        </activity>
        <activity android:name=".activities.qr.ThingsActivity" >
        </activity>
        <activity android:name=".activities.qr.InvestigationsActivity" >
        </activity>
        <activity android:name=".activities.qr.RisksActivity" >
        </activity>
        <activity android:name=".activities.qr.TeachingActivity" >
        </activity>
        <activity android:name=".activities.management.SocialActivity" >
        </activity>
        <activity android:name=".activities.management.PsychologicalActivity" >
        </activity>
        <activity android:name=".activities.management.BiologicalActivity" >
        </activity>
        <activity android:name=".activities.management.AssessmentActivity" >
        </activity>
        <activity android:name=".activities.management.ReflectionsActivity" >
        </activity>
        <activity android:name=".activities.management.learningActivity" >
        </activity>
        <activity android:name=".activities.SummaryPatientsActivity" >
        </activity>
        <activity android:name=".activities.FinalSummaryActivity" >
        </activity>

        <activity
            android:name=".activities.ConfirmActivity"
            android:clearTaskOnLaunch="true" >
        </activity>
    </application>

</manifest>

回答1:

The problem was solved by creating a new thread for authentication,This is necessary for the application to work on or above 4.0



回答2:

Ipv6 router setting. Switch to ipv4 to verify