Integrations using Android Intents

Hi @alex and team,

I’m interested in whether it’s possible to launch specific activities in OppiaMobile from a data collection app using Android Intents instead of using a standard weblink as described in the OppiaMobile docs? Am I understanding the docs correctly that the weblinks only work if the user is online?

What are the options for launching Oppia from another app if the user is offline and has both applications downloaded, and is registered/logged in for both apps?

Thanks,
Julie

1 Like

Hi Julie
This is very possible and has actually been done before. A previous project in Parkistan managed deploy a Prototype Combining Oppia mobile and OpenSRP. As long as you had installed both apps and downloaded the required course material, you could launch oppia mobile activities from OpenSRP.

2 Likes

Hi,
To complement @hakimks’s point, and answering your other question, the weblinks work even if the device doesn’t have internet connection. When the user clicks an Oppia link from any app, Android will prompt the user to select the app they want to open the link with (my phone is in Spanish, sorry, that dialog says “Complete the action using: - Always - Just once”):


If the user selects a browser (Chrome in my screenshot, could be any other installed), if the device has no internet nothing will happen, because the browser needs internet connection to handle the link, but if an Oppia app is selected, it will directly load the activity (if it is available in the device). I’ll have a look at the documentation and make this clearer.

For the Intent integration, it is totally possible, the weblink approach is just one specific use case of Android Intents, so there would be almost no additional development involved, just adding the Intent filter to be able to be called from different apps instead of using the URL scheme.

Another thing to point out: the use of Android Intents to open specific content in one app from a different app needs to be done at the programming level, so you need control of that other app. I guess that is the case, but I wanted to metion it just in case I was taking it for granted :slight_smile:

1 Like

This is super helpful, thank you both for the quick and thorough responses!

I reviewed and updated the documentation page and added more explicitly that there is no need for an active internet connection for the weblink integration. I’ve also included more up-to-date screenshots and the server-related part for when the user selects to open the link in the browser.

https://oppiamobile.readthedocs.io/en/latest/implementers/integration/launch_from_other_app.html

Hey there, I’m Irene from Medic Mobile, working with @Julie and team, and we are looking to integrate the Community Health Toolkit (CHT) with Oppia for CHA learning.
Here is an outline of how I used a web link to launch Oppia from the CHT for a demo:

Considerations:

  1. I had both apps (CHT and Oppia) installed
  2. I had registered as a user on Oppia
  3. I had internet connection
  4. I had a specific course downloaded on my device (available offline)
  5. One to one i.e. 1 device per user and the app used by the owner of the device only

From Oppia docs, it is possible to link to an activity (web link) that will prompt the user to choose the application that they want to use to open the activities as documented here. I obtained the digest of the specific activity I wanted to link to using adb, and linked the app as per CHT and Oppia documentation. From the documentation, the digest of an activity can be obtained from modules.xml folder of course zip package. I could access the link through:

  1. Web browser on desktop - prompted to download the app,
  2. On the mobile version of web browser, it brings up the app actions that can open the app and land on a page provided on the linking option, keeping in mind I had the course and the app available on my phone.
  3. On the CHT app it went white blank on clicking the button.

I had a seamless transition to Oppia, but this is due to having everything setup already. Some team members encountered several re-directions, and were still not able to access the course content. Some of the concerns raised from this experience include:

  1. If the user does not have the applications installed are they redirected appropriately?
  2. If the user does not have the course installed does it redirect them to the course that they should be downloading, and then to the course activity?
  3. How would we download and prep OppiaMobile, the modules, and settings on user devices?
  4. What happens if user is not able to access the play store or course material and they’re in an area with poor/no network coverage?
  5. Information exchange between CHT and Oppia (metric collection) and if user-specific data to be sent to Oppia, in the case where the user is not using their own device
  6. If user is able to complete a module, they should be able to navigate back to the CHT, what happens if they’re not able to? Also ties in with information that is imported from Oppia to CHT.
  7. Do web links simply act as a link out without CHT expecting any data/information from Oppia and vice versa?
  8. Who creates the course, how are they created and who has access to them?
  9. Can we curate a download category e.g. “Covid-19 - Uganda” with the appropriate courses?

From this experience it seems appropriate to use both android intents (to enable navigation and communication between CHT and Oppia) and web links (to open specific activities on Oppia, if we’re to have a number of courses, and to make these easily configurable on CHT).

1 Like

Hi!
Joseba here, from the Oppia dev team :slight_smile: I’ll try to answer your questions from the technical side (I hope it doesn’t get too lengthy…).

But first of all, as a general response, I agree with you that this level of integration requires the use of a more specific Android Intent than the weblink approach. With this I mean creating a custom Intent filter that serves as an entry point for external apps, that can pass arguments in a deeper level, in opposition to the broad BROWSABLE filter currently used in the weblink approach.

With the weblink approach, they would get redirected to the server page, and from there they have the option to download the app from Google play. Using the more specific intent approach, the CHT app can check beforehand if there is any app installed that can manage the intent, and show a message within the app context before trying to redirect them.

Currently, if the user does not have an activity that contains that digest the app simply shows a message informing of that. I think that would be a nice feature to add! I’ll add it to the issue list for consideration.

For the weblink use case, if the user does not have the app installed, the link will be opened in the browser. If there is no network connection available, the page won’t be loaded, so there is no chance for even redirecting to Google play. I think the other scenarios are covered in the previous answers, but let me know if there is something else that you feel is missing.

Using a specific intent, the app can send back information about the outcome of the action. What the specific information is would need to be defined.

Yes, with the weblink intent there is no possibility to retrieve the outcome of the action… even the target app (Oppia in this case) doesn’t have any actual knowledge of where the intent is coming from.

For this one, I’ll point you to the Oppia doc’s for content creation, I think there it’s covered mostly everything for the tech part.

Sure! You can configure course categories from the Oppia server.

For the questions #3 and #5, that involve more the management/implementation side, I’ll let @alex answer.

Thanks a lot for the detailed response and explanation, Joseba!

I understand that it would be possible to let the CHT app know that a user completed the course in the Oppia app using an intent which carries that information. Is that correct?

If so, would each intent need to be added to the code of the app or could they be added to the course content?
I’m asking because I’m wondering to which extent it would be possible to add a course incl. an intent to send certain information back to CHT without having to install an update of the app itself.

Hi @Irene & @Manuel ,

I think there’s quite a bit to go through here, and some might be better on a call sometime (we can schedule one between Oppia team, LMH and Medic Mobile sometime in the next week or so)

But in the meantime, I think it’s useful to draw a distinction between front-end and back-end integration of these apps (and data exchange), by this I mean…

  • front-end - what the user sees/does on their device, eg linking directly from the CHT app to an activity in Oppia.
  • back-end - for linking up learning/training activity (in Oppia) with professional activity (eg visits, immunisations, etc)

My guess would be that linking up data on Oppia course completedness might be better done via the back end than sending the data on the front-end side in an intent.

It might be useful for you to have a look at the concept I wrote up of using xAPI for the backend data integration (see: https://docs.google.com/document/d/1SlhcS2GjzxZbSSCjzhnPdPPrEUd2W8lxLhNWpu17jbs/edit) Note that this not intended to replace other types of integration (eg with DHIS2).

Anyway, I’m sure a lot to follow up on a call,
Cheers,
Alex

2 Likes

Hey @jjoseba and @alex , thank you for the detailed technical feedback on using the intents. As @alex has suggested, It would be great to follow up on a call this week. I’ve been co-orinating with @Julie to find an appropriate time to advance the discussions from both ends. I have sent an invite to both @alex and @jjoseba, kindly let me know if you’re available at that time. Thank you.