Mapping and GIS Solutions Community

 View Only
Expand all | Collapse all

Catalyst SDK - license problem during connection

  • 1.  Catalyst SDK - license problem during connection

    Posted 05-02-2019 06:32

    #catalystsdk

    We try to make our application Catalyst ready, based on the provided CatalystFacadeDemo code.

    I have implemented the needed classes and methods. I got a test antenna from our reseller. Testing of the load subscription via TMM and the driver init with DriverType.Catalyst is succeeded. But when I try to call the connect() method of CatalystFacade class,  I have received DriverCode: ErrorNotConnected, furthermore in last Catch() block the thrown java exception is: trimble.jssi.LicenseException: Invalid License detected(-1).

    I have done only debug build yet, so I use the App guid, what can be found in demo apps Mainmodel.java.

    Should it work this way?

     

    Thank You in advance!



  • 2.  Re: Catalyst SDK - license problem during connection

    Posted 05-07-2019 04:18

    Hi,

     

    sorry for the late reply - just saw this... 

    The exception - does it happen inside the Facade sample app or in your application?

     

    Licensing basically works in the way that:

    - Login in will download the license to the device (SD card)

    - LoadDriver/ Connect will parse the license file and check content.

    So for this your applications needs a bunch of permissions - most important

    - External Disk (to store the file)

    - Phone status (to read out the device serial - which is part of the license file)

    - Wifi (to download)

    I could imagine that either a permission is missing completely or the runtime check is missing - meaning the permission switch in Settings --> Applications is off.

     

    This is the full set copied from the docu:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

     

    My guess is something is fishy here - otherwise please reach out via email to tpsdk-catalyst-ug@trimble.com via the email you registered to TID. So we can ensure there is no issue on that layer (so with the TID account)

     

    Regards

    Nico



  • 3.  Re: Catalyst SDK - license problem during connection

    Posted 05-07-2019 04:45

    Dear Nico!

    Thank You for the reply! Ever since I manage to find the problem based on the CatalystFacade demo. There was a threading problem. The CatalystFacade.connectToSensor() method should be awaited by the caller method.



  • 4.  Re: Catalyst SDK - license problem during connection

    Posted 03-27-2020 08:58

    @Miklós Nagy I had this same issue and the problem for me as well was a threading issue. I suggest that if others have the same exception being thrown and all permissions are properly set for your application, make sure you are properly calling the connect method from a separate thread.

     

    Thanks for this post!



  • 5.  Re: Catalyst SDK - license problem during connection

    Posted 03-27-2020 09:24

    Hi @Charles Bisbee,

    out of curiosity... What caused the misunderstanding with regards to the Connect() method.

    I'm asking because I'm currently recording videos on how to get started with our stuff; in my sample app I called everything from the main UI thread knowing that this is blocking the UI - not exactly best practice etc but I thought good enough for simplicity. 

    I mentioned it in my talking - but I'm now wondering if I should redo this...

    So was the original problem not calling it from a worker thread OR was it not handling the return???

    Because the license exception is still weird in this context.



  • 6.  Re: Catalyst SDK - license problem during connection
    Best Answer

    Posted 03-27-2020 10:26

    What resolved the issue for me was calling the Connect() method on a worker thread. I was trying to get something really rough running so I was calling it on the UI thread like you mentioned and I was definitely confused when I was getting the Invalid License Exception. The only difference I could see between my code and what was implemented in the CatalystFacade was that the facade calls the Connect() method via the RunOnThread method. I implemented this on my side and that indeed fixed the issue. I agree that the license exception is a little bit puzzling and I am glad that I found this post where Miklos mentioned threading or else I may have had some issues working it out.

    EDIT:

    Something important to note was that I am not interfacing with CatalystFacade in my application. I am directly using the ISensor interface. When I called sensor.Connect(connectionSettings) that method would run and run and eventually throw the licensing exception. Calling that method now from the worker thread now properly returns. I think it has something to do with blocking the system dialog that gets displayed asking the user to "Allow Trimble Catalyst Service to access Catalyst DA1", if UI thread is blocked and the user can't press OK on that dialog the connect call fails which makes sense.



  • 7.  Re: Catalyst SDK - license problem during connection

    Posted 03-29-2020 23:32

    Thanks for the details.

    I'll rework the stuff I'm currently working on to put a greater emphasis on the worker threads - nearly all functions in our SDK should be called from... Well... Not the main thread. The facade does this - but also not really obvious.

     

    Thank you!