There are couple of things to mention here.
There are no such in-built APIs to broadcast / uni-cast the location and orientation of an Android user to other Android users.
Lets take the same example of Uber.
So, when a driver is online, a constant connection is set between the user and the Uber Server. These are mainly Sockets connections. The server pings the driver mobile device constantly and when needed and in turn the app returns the location and the orientation of the device which is updated in the Uber Server.
Now, when a customer opens the app, the device location is sent as a part of the request parameters and the server returns the cabs details which includes the location and the orientation.
You could see there sometimes that the driver is moving from one location to the another. They are the results of constant update of data among
Driver Device -- Uber Server -- Customer Device
Now the question comes how can you detect the orientation of a device. You could find it here.