ExecSystem function - passing intent parameters when starting external activity

Discussions about creating CAPI applications to run on Android devices
Forum rules
New release: CSPro 8.0
Post Reply
alex_izm
Posts: 19
Joined: December 9th, 2016, 11:31 am

ExecSystem function - passing intent parameters when starting external activity

Post by alex_izm »

Salutations my fellow CSPro users.

I have a need to start an external app from the CSEntry application. As documentation states that is achieved by calling ExecSystem function with parameter "app:app.name". However I was wondering if there was a way to start an external activity and also pass some parameters to said activity along with the start intent? Is something like this possible at all? if not, is there some kind of workaround that I'm missing?

Thanks!!!
Alex
htuser
Posts: 631
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: ExecSystem function - passing intent parameters when starting external activity

Post by htuser »

Hi Alex,
However I was wondering if there was a way to start an external activity and also pass some parameters to said activity along with the start intent?
Yes. The new SystemApp Object allow to interact with external activities and also pass some parameters using SystemApp.SetArgument Function. You can also get data from other applications using SystemApp.GetResult Function.
Please download the latest beta: https://www.csprousers.org/beta/ and read more about the new SystemApp Object.

And as Greg and Josh written me days ago:
With SystemApp, you can communicate back and forward between another application, sending data to it and receiving data from it. There is an example of it here:
https://github.com/CSProDevelopment/CSE ... lback-demo

...we’ve implemented SystemApp as a way for users to have a seamless way to communicate between CSEntry and another app.
This interest me greatly since right now, we can access to other application and other applications can also access to CSEntry data and activities. I'll try to implement a CSEntry helper and we can share experiences about in the next weeks.

However,the Developer Team can give you more explanations about it.
Best,
G.VOLNY, a CSProuser from Haiti, since 2004
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: ExecSystem function - passing intent parameters when starting external activity

Post by josh »

Systemapp is new in version 7.4 and it is documented in the latest beta release. You can download that and search for systemapp in the help. It lets you set numeric and string parameters that will get passed to the Activity you are launching as part of the intent. For example the following code will launch maps with driving directions from your current location to the US Census Bureau:
SystemApp nav_to;
nav_to.setArgument(
"DATA", "google.navigation:q=US+Census+Bureau");
nav_to.setArgument(
"ACTION", "android.intent.action.VIEW");
nav_to.exec(
"com.google.android.apps.maps");
alex_izm
Posts: 19
Joined: December 9th, 2016, 11:31 am

Re: ExecSystem function - passing intent parameters when starting external activity

Post by alex_izm »

Great, this is exactly what I was looking for! Thanks Josh, Htuser!!!

I am still in 7.3, but will now definitely check out 7.4 beta.

Alex
Post Reply