Android Question Who can help data transfer with an app to app

Wolli013

Well-Known Member
Licensed User
Longtime User
Who can help me to read out data transmission from another app?
I need to read out a temperature and humidity measuring device (SmartProbes 605-i) from Testo.
Here is the info link from Testo on how to do it.

As I have never dealt with something like this before (App to App), I have my problems.

Starting the Testo app works, my app is set in pause mode. How do I get the measurement data now?

Translated with DeepL.com (free version)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Something like:
B4X:
Dim bundleid As String = "test17"
Dim url As String = $"${scheme}://start?bundleid=${bundleid}&userinfo=0"$
Dim in As Intent
in.Initialize(in.ACTION_VIEW, url)
StartActivity(in)

And manifest editor:
B4X:
AddActivityText(Main,
 <intent-filter>
        <data android:scheme="testoapp+test17" />
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
      </intent-filter>
    </activity>
)

You can get the result with Activity.GetStartingIntent (search the forum for IsRelevantIntent)
 
Upvote 0

Wolli013

Well-Known Member
Licensed User
Longtime User
Thank You.

Is it normal that my app then goes to pause? what goes to test17? my package name?
I have that in the resume now.

B4X:
If IsRelevantIntent(Activity.GetStartingIntent) Then
     Dim in As JavaObject = Activity.GetStartingIntent
     Dim uri As String = in.RunMethod("getParcelableExtra", Array("android.intent.extra.STREAM"))
       Log("Testo Daten: " & uri)
   End If
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Switch to B4XPages. Your app will not be paused (unless the process is killed).
2. Get the starting intent in B4XPage_Foreground:
B4X:
B4XPages.GetNativeParent(Me).GetStartingIntent
3. You need to make sure to check whether this intent was already handled as it isn't cleared.

B4X:
Dim NewIntent As Intent = B4XPages.GetNativeParent(Me).GetStartingIntent
If NewIntent <> OldIntent Then
 OldIntent = NewIntent
 'here check that this intent has the relevant information
End If
 
Upvote 0
Top