Anybody seen/solved this Bluetooth Admin issue?

kimble01

Member
Licensed User
Longtime User
All,
I've run into a strange issue perhaps someone can help me with:

I define a BluetoothAdmin object and a Serial object in the ProcessGlobals of my activity, then I initialize those objects in the FirstTime condition in ActivityCreate:
B4X:
If FirstTime Then
   clsErrorsEvents.Initialize
   objphone.SetRingerMode(objphone.RINGER_SILENT)
   
   If Not(admin.IsInitialized) Then
      admin.Initialize("btAdmin")
   End If
   If Not(admin.IsEnabled) Then
      admin.Enable
   End If
   Serial1.Initialize("btSerial")

Then I call into a webservice to check for a valid user in the ActivityCreate:

B4X:
Activity.LoadLayout("InitialScreen")
   ProgressDialogShow("Checking for valid user...")
   Log("Checking for valid user with " & objPhoneID.GetLine1Number & " and " & mapDeviceInfo.Get("edtreceivingnumber"))
   mapMessage.Put("DeviceNumber", objPhoneID.GetLine1Number)
   mapMessage.Put("RemoteNumber", mapDeviceInfo.Get("edtreceivingnumber"))
   mapMessage.Put("EventCode", clsErrorsEvents.EventCodes.CheckForServiceEvent)
   mapMessage.Put("BlueToothMac", strBTMac)   
   objJSONGen.Initialize(mapMessage)
   Log("About to call CheckForService with the message:" & objJSONGen.ToString)
   Dim objJob As HttpJob
   objJob.Initialize("ValidUser", Me)
   Log("About to check valid user with: " & objJSONGen.ToString)
   Dim tmpString As String: tmpString = strWebServiceURL & "ProcessMessage"
   Try
      objJob.PostString(tmpString, objJSONGen.ToString)
      objJob.GetRequest.SetContentType("application/json")
   Catch
      Log("An Error was raised trying to contact the webservice: " & LastException.Message)
      BuildSupportScreen
   End Try

I am handling the serialconnect and admin statechanged events although I am only logging the results, not taking any action.

Here's the issue:
When Bluetooth is off and this code executes, I get the following:


The bluetooth adapter is succesfully enabled, but the program obviously dies.

Is there a why to trap this error? It is definitely related to calling into HttpUtils service, but why is beyond me.

Any help will be appreciated.

Thanks,
Gary

EDIT
I thought it was related to the HttpUtils call, but after disabling that call I am definitely able to recreate this error. I went digging into my libraries and discovered duplicate libraries in the AddLibraries and Libraries folders. I am curious who wins in that scenario...Administrator, GPS, and a couple others were duplicated. I removed all duplicates from the AddLibraries folder as an initial step...problem remains.

When I went into the raw logs for the initialization routine I see this:
Raw logs too long, even after editing... I'll put in a quickreply...
 
Last edited:

kimble01

Member
Licensed User
Longtime User
Raw logs relevant sections...



It appears that the Bluetooth Adapter is interacted with long before my application attempts to enable it...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…