Sub Service_Start (StartingIntent As Intent)
Log(StartingIntent)
Log(StartingIntent.ExtrasToString)
End Sub
AddReceiverText(s2, <intent-filter>
<action android:name="android.bluetooth.device.action.ACL_CONNECTED"/>
</intent-filter>)
AddPermission(android.permission.BLUETOOTH)
AddReceiverText(s2, <intent-filter>
<action android:name="android.bluetooth.device.action.ACL_CONNECTED"/>
<action android:name="android.bluetooth.device.action.ACTION_ACL_DISCONNECTED"/>
</intent-filter>)
'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.b4x.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"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)'tastatura
AddApplicationText(
<activity android:name="com.tapit.adview.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"/>
)
AddReceiverText(s2, <intent-filter>
<action android:name="android.bluetooth.device.action.ACL_CONNECTED"/>
<action android:name="android.bluetooth.device.action.ACTION_ACL_DISCONNECTED"/>
</intent-filter>)
AddPermission(android.permission.BLUETOOTH)
AddActivityText(main, <intent-filter android:priority="1000">
<action android:name="android.intent.action.VOICE_COMMAND" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
)
AddPermission(android.permission.MODIFY_AUDIO_SETTINGS)
AddPermission(android.permission.BLUETOOTH_ADMIN)
AddPermission(android.permission.BROADCAST_STICKY)
AddPermission(android.permission.CALL_PHONE)
AddPermission(android.permission.CHANGE_NETWORK_STATE)
AddPermission(android.permission.SEND_SMS)
AddPermission(android.permission.RECEIVE_SMS)
AddPermission(com.android.alarm.permission.SET_ALARM)
AddPermission(android.permission.CHANGE_WIFI_STATE)
AddPermission(android.permission.WRITE_SMS)
Can you post the code in s2 service?
Sub Service_Start (StartingIntent As Intent)
Log(StartingIntent)
Log(StartingIntent.Action)
If StartingIntent.Action="android.bluetooth.device.action.ACL_CONNECTED" Then
CallSubDelayed(Main,"show_btmode") 'actually this sub is showing a bluetooth bitmap to inform user that a connection is present (one way only :))
End If
End Sub
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim BT_Service_connected As Boolean
End Sub
Sub Service_Create
BT_Service_connected = False
End Sub
Sub Service_Start (StartingIntent As Intent)
If StartingIntent.Action = "android.bluetooth.device.action.ACL_CONNECTED" Then
Log("BT_Connect")
BT_Service_connected = True
' THE STATEMENT BELOW IS NOT EXECUTING IN MY CASE... !!
Else If StartingIntent.Action = "android.bluetooth.device.action.ACL_DISCONNECTED" Then
Log("BT_Disconnect")
BT_Service_connected = False
CallSubDelayed(Main, "BT_Disconnect")
End If
Log(StartingIntent)
Log(StartingIntent.ExtrasToString)
End Sub
Don't count on it. If the process is killed then the queue is killed as well. If there is any important data you need to save it to a file and later read it when the process starts.the message in waiting queue is ok
Create a service named s2 with this code:
B4X:Sub Service_Start (StartingIntent As Intent) Log(StartingIntent) Log(StartingIntent.ExtrasToString) End Sub
Add the following code to the manifest editor:
B4X:AddReceiverText(s2, <intent-filter> <action android:name="android.bluetooth.device.action.ACL_CONNECTED"/> </intent-filter>) AddPermission(android.permission.BLUETOOTH)
Make a connection and check the logs.