Hello,
I'm an absolute newbie in Android programming (since 5 days), and this is also my first post, so I guess this is a double introduction!
I've done a little app (let's call it APP2) that detects device position and downloads elevation data for that geographical zone to be used with GPS navigators. The developer of a navigator (APP1) wants to put an option in his app to call mine and retrieve the elevation data file relative to the coordinates given by his app, allowing the user to navigate into a map, visualize a zone, long tap and select 'download elevation data', or something like that, and in that moment, APP2 is supposed to open with a pair of textboxes filled with the coordinates.
To do that, he asked me to implement an Intent in APP2, in a way that he can call APP2 from APP1 passing latitude and longitude as arguments in a single string, separated by a comma.
I've added this lines to my project, in their respective subs:
Will it work? I've tried to program quickly a basic app to invoke APP2, with a single button, adding this code to the Button1_Click Sub:
When I run this test app and press the button, the debugger stops in
StartActivity(IntentA)
With the following exception:
adroid.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.MAIN dat=null flg=0x20000 }
I'm sure I'm missing a lot of things, but after googled a lot I only found Intent examples to call Android native apps, to select between several programs to open a given file format... but nothing similar to this situation.
Can anybody give me a hint??
Thanks in advance
I'm an absolute newbie in Android programming (since 5 days), and this is also my first post, so I guess this is a double introduction!
I've done a little app (let's call it APP2) that detects device position and downloads elevation data for that geographical zone to be used with GPS navigators. The developer of a navigator (APP1) wants to put an option in his app to call mine and retrieve the elevation data file relative to the coordinates given by his app, allowing the user to navigate into a map, visualize a zone, long tap and select 'download elevation data', or something like that, and in that moment, APP2 is supposed to open with a pair of textboxes filled with the coordinates.
To do that, he asked me to implement an Intent in APP2, in a way that he can call APP2 from APP1 passing latitude and longitude as arguments in a single string, separated by a comma.
I've added this lines to my project, in their respective subs:
B4X:
Sub Globals
...
Dim IntentB As Intent
End Sub
Sub Activity_Create(FirstTime As Boolean)
...
IntentB.Initialize("ACTION_MAIN","")
If IntentB.GetData <> Null Then
Dim argus As String
argus = IntentB.GetData
Dim posi As Int
posi = argus.IndexOf(",")
txtLatitud.Text = argus.SubString2(0, posi)
txtLongitud.Text = argus.SubString2(posi + 1, argus.Length)
End If
...
End Sub
B4X:
Sub Button1_Click
Dim IntentA As Intent
IntentA.Initialize(IntentA.ACTION_MAIN,"47.0000,7.0000")
IntentA.SetComponent("com.blahblahblah.app2")
StartActivity(IntentA)
End Sub
When I run this test app and press the button, the debugger stops in
StartActivity(IntentA)
With the following exception:
adroid.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.MAIN dat=null flg=0x20000 }
I'm sure I'm missing a lot of things, but after googled a lot I only found Intent examples to call Android native apps, to select between several programs to open a given file format... but nothing similar to this situation.
Can anybody give me a hint??
Thanks in advance