Home > front end >  Application only works debug mode & specific Ip with mongoDb
Application only works debug mode & specific Ip with mongoDb

Time:07-09

I am working on a flutter project with mongoDB, there is no big deal at project I just want to SignUp user, but application works only on debug mode and with my mobile Hotspot. otherwise I just click signUp button and I wait long time, then ********** "SocketException: Connection timed out (OS Error: Connection timed out, errno = 110), address = 10.76.236.118, port = 44670". *********** this error throw. I work with real device android Samsung Galaxy A50 (SM-A505F), I don't think there's any error in the codes. Because it works when debug specific IP(when I use my mobile hotspot).However, let me share the screenshot of the relevant parts. what are the things I don't know ,about IP or mongoDB or ....

enter image description here

enter image description here

enter image description here

enter image description here

./android/app/src/main/AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.shopping">
    <uses-permission android:name="android.permission.INTERNET"/> 
   <application
        android:label="shopping"
        android:name="${applicationName}"
        android:icon="@mipmap/launcher_icon">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>

CodePudding user response:

If you work with a real device, your phone and your laptop have to be connected to the same internet. This is solution for me. Dont't forget add " " at ./android/app/src/main/AndroidManifest.xml

  • Related