App closes the moment it is opened

Correct, the native LocationSensor does not provide a bearing. Only the very impressive Advanced Location Sensor Extension by Niclas Gins does that as far as I am aware (by parsing a NMEA string).

How? Either by using bearing or parsing the NMEA
$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A

Field Meaning
0 Message ID $GPRMC
1 UTC of position fix
2 Status A=active or V=void
3 Latitude
4 Longitude
5 Speed over the ground in knots
6 Track angle in degrees (True)
7 Date
8 Magnetic variation in degrees
9 The checksum data, always begins with *

Trak angle is what contains the information to surmise direction of travel.

There are several Location Sensor type extensions. Juan Antonio's extension LocationSensor Extension. Accuracy. Geocoder. GeomagneticField has bearing ... that might do the same thing.

@Someshvar_Vashisht You asked a similar question here

Do you know what the trak angle is and what you can do with it? The track angle is the direction that the vehicle is moving in, as opposed to the direction it is pointing in. The track angle is also derived from velocity and is the same angle that GPS puts out. In all actuality, the track angle has little to no relationship with the direction the vehicle is pointing in.