The document didn't mentioned that it may return null , is it a firmware bug or designed like this.
The document didn't mentioned that it may return null , is it a firmware bug or designed like this.
General rule, null check everything. This is something you may not see in the sim when doing fit simulation, based on when you start that and when you start recording.
Actually, the general statement in the doc for Activity.Info is this
The Activity.Info class contains information about the current activity.
This information can be retrieved with the getActivityInfo() method. Fields in this class may return null
so should be checked for null values prior to use.
That true , the problem didn't occured in the simulator or on my watch , but only in GPS , that's quiet confusing . I have added null check to the code .