Android Tutorial Android Bluetooth / BluetoothAdmin Tutorial

Status
Not open for further replies.

Scantech

Well-Known Member
Licensed User
Are you sure that there are no bluetooth devices near you?

The DeviceFound event is raised as a result of the native API. It will only add devices reported by the OS.
I will do some more investigating. I was in the apartment when I did a search. Not Sure how many other Bluetooth devices are around me. When Away from the apartments it is working properly.
 
Last edited:

techknight

Well-Known Member
Licensed User
Why they would put that in the locations permission is completely asinine, because this could lead into a false sense of "insecurity" when installing an app and someone actually looks at the permissions. "Why does it need to know my location?" phrase... GRRR google....

Anyways... Can someone try on Android M if location is disabled, if BT discovery still works?
 

DavideV

Active Member
Licensed User
Why they would put that in the locations permission is completely asinine, because this could lead into a false sense of "insecurity" when installing an app and someone actually looks at the permissions. "Why does it need to know my location?" phrase... GRRR google....

Anyways... Can someone try on Android M if location is disabled, if BT discovery still works?
I agree with you about the permissions, too much for bluetooth discovery in my opinion.
Could be for ibeacon?
isn't it a sort of bluetooth localization?
 

Mitesh_Shah

Member
Licensed User
HI CAN ANY ONE TRY IN NEW ANDROID OS 6.0 ?

I AM TRY IT IN MY LENOVO K3 NOTE PHONE - ANDROID 6.0 IT'S NOT WORKING. GETTING ERROR DEVICE NOT FOUND

BUT IT'S WORK IN KITKAT AND LOLLIPOP Version

REGARD

MITESH
 

Erel

Administrator
Staff member
Licensed User
Please do not write ALL CAPS messages.

Are you using B4A v5.80?
 

Erel

Administrator
Staff member
Licensed User
You need to add this permission with the manifest editor: android.permission.ACCESS_COARSE_LOCATION
 

Mitesh_Shah

Member
Licensed User
HI Erel

I m add >>android.permission.ACCESS_COARSE_LOCATION to Region Module Attributes but, getting Compiling Error.

Parsing code. Error
Error parsing program.
Error description: Attribute not supported: android
Occurred on line: 10
#Android:permission.ACCESS_COARSE_LOCATION
 

Erel

Administrator
Staff member
Licensed User
You need to add it in the manifest editor: Project - Manifest Editor:
B4X:
AddPermission(android.permission.ACCESS_COARSE_LOCATION)
 

red30

Active Member
Licensed User
I use your example. The data is transmitted. Not working reception ... What am I doing wrong?
B4X:
#Region Module Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

'Activity module
Sub Process_Globals
    Dim AStream As AsyncStreams
    Dim bc As ByteConverter
End Sub

Sub Globals
    Dim readings As EditText
    Dim label1 As Label


End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("2")
    readings.Color = Colors.black
    If AStream.IsInitialized = False Then
        'AStream.InitializePrefix(Main.serial1.InputStream, True, Main.serial1.OutputStream, "AStream")
        AStream.Initialize(Main.Serial1.InputStream, Main.Serial1.OutputStream, "AStreams")
    End If
End Sub

Sub AStreams_NewData (Buffer() As Byte)
    readings.Text=Buffer
    label1.Text=("Data: " & bc.HexFromBytes(Buffer))
End Sub

Sub AStream_Error
    ToastMessageShow("Connection is broken.", True)
End Sub

Sub AStream_Terminated
    AStream_Error
End Sub

Sub Activity_Resume
  
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    If UserClosed Then
        AStream.Close
    End If
End Sub

Sub LightOn_Click
    AStream.Write(Array As Byte(0x00,0x05,0x3f))
End Sub
 
Status
Not open for further replies.
Top