Problems with connection between tablet and btm

stopa

New Member
Licensed User
Longtime User
Hi,
I'm new here.

I'm beginner at Basic4Android and I have some problems with connection between my BTM-222 nad Tablet Nexus 7. I made a application and it works perfect on my Motorola Milestone 2 - when I have paired BTM and my phone I just push the button on my app and I'm connected with my module. In tablet it's doesen't work and I don't know why.

There's part of my program to connect:
B4X:
Sub Button1_Click
   If Flaga=False Then
      Dim Urzadzenia As Map
      Dim Lista As List
      Dim Wybierz As Int
      Urzadzenia=Adapter.GetPairedDevices
      Lista.Initialize
       For i=0 To Urzadzenia.Size-1
       Lista.Add(Urzadzenia.GetKeyAt(i))
      Next
       Wybierz=InputList(Lista,"Wybierz urządzenie",-1)
      If Wybierz >= 0 Then
         Timer1.Enabled=False
         Timer2.Enabled=True
         Button1.Enabled=False
         Adres=Urzadzenia.GetValueAt(Wybierz)
         Nazwa=Urzadzenia.GetKeyAt(Wybierz)
         Adapter.Connect3(Adres,1)
      End If
   Else
       Strumien.Close
       Adapter.Disconnect
      Flaga=False
   End If          
End Sub

Timers:
B4X:
Sub Timer1_Tick
    Try
    If Adapter.IsEnabled=True Then
       Button1.Enabled=True
       Label1.Text=Adapter.Address
       If Flaga=True Then
          Button1.Text="MAC " & Nazwa & CRLF & Adres
         EditText1.Visible=True
         Button2.Visible=True
       Else
          Button1.Text="Brak połączenia. Kliknij aby połączyć"
       End If
    Else 
       Button1.Enabled=False
       Label1.Text="Bluetooth wyłączony"
      Button1.Text="Brak połączenia" & CRLF & "kliknij aby połączyć"
      Flaga=False
    End If
   Catch 
   End Try   
End Sub
Sub Timer2_Tick
    Timeout=Timeout+1
   ProgressBar1.Visible=True
    If Timeout=100 Then
        Timeout=0
      ProgressBar1.Visible=False
      Timer2.Enabled=False
      Timer1.Enabled=True
    End If
        ProgressBar1.Progress=Timeout
End Sub
 
Top