I read all threads for bluetooths and I did to different service to hold the Connect and Disconnect intent but I just receive the Connect intent.
Bellow is my manifest
follow the service
Someone can help ?
Bellow is my manifest
B4X:
'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: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'End of default text.
AddPermission(android.permission.BLUETOOTH)
AddReceiverText(detect_bluetooth, <intent-filter>
<action android:name="android.bluetooth.device.action.ACL_CONNECTED"/>
</intent-filter>)
AddReceiverText(disconnect_bluetooth, <intent-filter>
<action android:name="android.bluetooth.device.action.ACTION_ACL_DISCONNECTED"/>
<action android:name="android.bluetooth.device.action.ACTION_ACL_DISCONNECT_REQUESTED"/>
</intent-filter>)
AddReceiverText(detect_bluetooth, <intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>)
AddReceiverText(detect_bluetooth, <intent-filter>
<action android:name="android.media.VOLUME_CHANGED_ACTION" />
</intent-filter>)
follow the service
B4X:
Region Service Attributes
#StartAtBoot: False
#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 Ini_Conf As KeyValueStore
End Sub
Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
Log ( "Verificando ..." )
Log(StartingIntent)
Log(StartingIntent.ExtrasToString)
If StartingIntent.Action = "android.bluetooth.device.action.ACTION_ACL_DISCONNECTED" Then
Log ( "Bluuetooth desconectado")
Ini_Conf.Initialize(File.DirDefaultExternal,"Ini_Conf")
Ini_Conf.PutSimple ("Blue_Name","" )
Log ( "Bluuetooth desconectado")
End If
End Sub
Sub Service_Destroy
End Sub
Someone can help ?