testo / tjf

Schema definitions of the Testo JSON format (tjf). Used in t300 / t330 / t330i / t400 / t420 / SmartProbes / t550 / t557 / t550s / t557s / testo Smart
https://www.testo.com
Apache License 2.0
6 stars 3 forks source link

QUESTION: Combustion App last and current Measurement and App update #4

Closed pbzek closed 2 years ago

pbzek commented 2 years ago

Hi Again,

Getting Data from the Combustion App via App 2 App communication returns a result from the Last Measurement. If the App is open, but in background, and you perform a reading in the linked testo device, then the Combustion App doesn't have the current measurement and if i get the call the app via port 53757 on the /data endpoint, i get the Last Measurement and not the current. I assume that this is the normal behaviour.

Is there any other endpoint on the Combustion App exposed API that i can call to force an update from the testo device and then perform a /data call to get Current measurement? Or the way the App works is opening the App to sync with the Testo Device and get the Current Measurements?

Thanks in advance for your response

gwaldvogel commented 2 years ago

Hi @pbzek unfortunately due to the design of the Combustion app there is no background refresh. Because of this it usually makes sense to call the Combustion app via the inter app communication described here: https://github.com/testo/tjf#inter-app-communication--app-to-app-interface-app2app This way your app will open the Combustion app, you can perform a measurement and then switch back to your app via the export button in the Combustion app and receive the measurement data as JSON (same JSON as via HTTP).

pbzek commented 2 years ago

Hi @gwaldvogel,

We are trying to use the App to App interface solution with the testo Combustion App as you recommended as an option to get a measurement, but when the app gets called, we perform a reading, and when the reading is done and we click on Export, we select JSON and click on the green check and we don't get the chance to select our app to export it.

We are successfully calling Combustion App with "testot330://start?bundleid=com.testoapp.testoreader"

We have added the data on the manifest <data android:scheme="testoapp+androiddatareceiverdemo" /> where we change testoapp with testot330 and androiddatareceiverdemo with testoreader but we don't see the option to export to our App.

We also tried with :

android:scheme="testoapp+com.testoapp.testoreader" android:scheme="testoapp+testoreader" android:scheme="testot330+com.testoapp.testoreader" android:scheme="testot330+testoreader"

But none of this scheme works for us and we cant export the json option to export to our app.

On the Manifest we have added the intent filter like this example you posted on other issue:

`<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.testo.androiddatareceiverdemo" android:versionName="1.1" android:versionCode="1" >

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".AndroidDataReceiverDemo" android:launchMode="singleTask">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <data android:scheme="testoapp+androiddatareceiverdemo" />
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
        <intent-filter>
            <data android:scheme="file"/>
            <data android:host="*"/>
            <data android:mimeType="application/json" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

`

Can you help us with this?

Thanks in advance

gwaldvogel commented 2 years ago

Hi @pbzek

We are successfully calling Combustion App with "testot330://start?bundleid=com.testoapp.testoreader"

Just to clarify, the bundleid contained in this URL should be the bundleid of your app. Please use testo330://... as there is a known issue with the Combustion App on Android where testot330 (with the additional t) does not fully work.

The response the testo app sends out will call the following URL: testoapp+${bundleid}://data?json=${base64json}. Your app needs to specify testoapp+${bundleid} as scheme inside the intent-filter:

<intent-filter>
  <data android:scheme="testopp+${bundleid}" />
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

If you have called the testo app with the correct parameters you will immediately be sent back into your app when pressing the export button.