Communication between two apps

Hello everyone.

So my app has one of the objectives being selection of hospital and showing route to it.

Initially, my app has to send a request signal to a hospital (application). The route to hospital must be shown iff the hospital app sends back an acknowledgement. Otherwise, the route to the nearest hospital needs to be viewed.

Is it possible to communicate between two apps for acknowledgement/request signals? How?

What should be done to show the route to the nearest hospital from a list of hospitals? I am already able to dind the closest hospital between two hospitals. If this list is to be made on a spreadsheet, how can I obtain/calculate the latitude and longitude to find the closest hospital?

Kindly help. Please.

1 Like

Welcome to the new AI2 Forum site Rohit.

Your question seems to be related to your previous questions in the ‘old’ Forum > for example https://groups.google.com/forum/#!searchin/mitappinventortest/rohit|sort:date/mitappinventortest/ivLItSb1lIU/d1oTxknOBQAJ

Answers were provided there to most of the questions you have now. What have YOU done? Show us your code and someone should provide specific advice.

Your new question: “Is it possible to communicate between two apps for acknowledgement/request signals? How?”

Yes. You could use a shared app that does a ‘chat’. Use either a CloudDB and your own server (you are building a commercial app) or the experimental FirebaseDB. How to do this depends on exactly what information needs to be exchanged and what needs to be done. This communication could also be initiating a phone call to the hospital.

You also asked “What should be done to show the route to the nearest hospital from a list of hospitals? I am already able to dind the closest hospital between two hospitals. If this list is to be made on a spreadsheet, how can I obtain/calculate the latitude and longitude to find the closest hospital?” Part of the answer is in the old Forum"

… The Line component can be used to show the straight-line distance. If you need to show a route , use this tutorial that shows how to do display a route with the Map component and OpenStreetMap tiles HOW TO use the new Map Control. plot a route and post driving distance and time .
do something similar (calculate distance and display a route)

and this mini-tutorial explains HOW TO: Use a Google Spreadsheet hosted on your Google Drive to update a Map (the example uses pharmacies (but not hospitals). You want hospitals, so use hospitals.

There are six ways to determine a route I am aware of:

  1. Use the Google Map API and a distance matrix using JSON
  2. Use the OpenStreetMap example OpenStreetMaps provides free distance/route information. HOW TO use the new Map Control. plot a route and post driving distance and time describes how to use it. It is a ‘free’ service however excessive usage will get charged. This example also shows how to determine the closest location from a List of all locations. Use that to determine the closest hospital nearest another hospital by slightly adapting the code.
  3. The ActivityStarter to launch Google’s Navigate app
  4. Something similar using the OSM web site and App Inventor OpenStreetMap without the Map Component
  5. You might be able to use MapQuest Open Directions API Web Service offers a limited number of transactions free per month.
  6. https://www.graphhopper.com/ is NOT free
    There may be other ways. Choose one and use it.

What don’t you understand? We are glad to help. Sharing your code so far with the forum by posting your blocks and a better explanation of how you think this would work would help.

What have you coded so far?

Regards,
Steve

1 Like

this might be an alternative A Chat Demo with App Inventor 2 and PubNubTM

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Thank you for the response, Steve and Taifun.

Apologies on my part for the late response.

I have hereby attached the entire blocks of my project so far.

As you can see, as soon as the screen is initialized, the app shows the route to one particular location. Now, this needs to be done only after it correctly receives an acknowledgement from the hospital.

I tried out the app suggested by Taifun and the apps can chat to send messages. I need to employ this as a way to get acknowledgement. The route to the primary hospital should be shown only after the acknowledgement is received. Else (if negative acknowledgement is received), the route to the nearest hospital should be shown. This nearest hospital is to be found from a list of hospitals, which I tried to do using the Algerian Pharmacy example. But the required routes are not being shown and the old Pharmacy markers are still visible.

Kindly help me.

may i see your app? we have same objectives