Android Question [SOLVED]Serial connection tablet & phone over tablet hot spot?

Discussion in 'Android Questions' started by camolas, Mar 18, 2015.

  1. camolas

    camolas Member Licensed User

    Hi,

    I want to send serial data from my phone to my tablet over my tablet hot spot , B4A wifi-direct only work for me over my router wifi not over tablet hot spot.
    Can this be done?

    Manny thanks
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You don't need to use wifi direct if you are creating a hot spot.

    Just use Network library and make the non-hotspot device act as the server.
     
  3. camolas

    camolas Member Licensed User

    Hi,

    Cant find a server code that can work for me i used the EchoClient on tablet (hot-spot) and a lot off server codes on phone (non hot-spot side) with no sucess, please advise me in what server code i must use?

    Thanks
     
  4. Erel

    Erel Administrator Staff Member Licensed User

  5. camolas

    camolas Member Licensed User

  6. camolas

    camolas Member Licensed User

    Hi,

    One final question can i "force" de phone to connect to the Tablet wifi hot spot programmatically?
    With AObject example i have to go to settings, network and select manually to enter.

    Thanks

    Paulo
     
  7. Erel

    Erel Administrator Staff Member Licensed User

  8. camolas

    camolas Member Licensed User

    One more time many thanks @Erel

    I used Wifi Connect lib

    Very simple code:
    Code:
    #Region  Project Attributes
        
    #ApplicationLabel: B4A Example
        
    #VersionCode: 1
        
    #VersionName:
        
    'SupportedOrientations possible values: unspecified, landscape or portrait.
        #SupportedOrientations: unspecified
        
    #CanInstallToExternalStorage: False
    #End Region

    #Region  Activity Attributes
        
    #FullScreen: False
        
    #IncludeTitle: True
    #End Region

    Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'These variables can be accessed from all modules.
    Dim Wifi1 As WiFiConnect
    End Sub

    Sub Globals
        
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.

        
    Private Button1 As Button
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    'Do not forget to load the layout file created with the visual designer. For example:
        Activity.LoadLayout("1")

    End Sub

    Sub Activity_Resume

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub

    Sub Button1_Click
        Wifi1.connectToSSID(Wifi1.WIFI_WPA, 
    "name""pass")
    End Sub
    Manifest:
    Code:
    'This code will be applied to the manifest file during compilation.
    'You do not need to modify it in most cases.
    'See this link for for more information: http://www.basic4ppc.com/forum/showthread.php?p=78136
    AddManifestText(
    <uses-sdk android:minSdkVersion=
    "4" android:targetSdkVersion="14"/>
    <supports-screens android:largeScreens=
    "true"
        android:normalScreens=
    "true"
        android:smallScreens=
    "true"
        android:anyDensity=
    "true"/>
    <uses-permission android:name=
    "android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:name=
    "android.permission.CHANGE_WIFI_STATE"/>
        )
    SetApplicationAttribute(android:icon, 
    "@drawable/icon")
    SetApplicationAttribute(android:
    label"$LABEL$")
    AddPermission(android.permission.CHANGE_WIFI_STATE)
    'End of default text.
    Its nice to learn :)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice