-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navigation events #489
Navigation events #489
Conversation
*/ | ||
public static int getVolumeLevel(Context context) { | ||
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); | ||
return audioManager.getStreamVolume(AudioManager.STREAM_SYSTEM); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on what @danesfeder has mentioned, Android has multiple streams for different types of audio. @danesfeder can you verify that this is the volume of the stream we'll be outputting voice on?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, let's make sure to normalize this as an int from 0-100 (it looks like there's a getStreamMaxVolume(int)
to normalize against)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danesfeder can you verify that this is the volume of the stream we'll be outputting voice on?
@danesfeder Anything to keep in mind here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ericrwolfe @zugaldia Yeah I'm streaming the voice audio through AudioManager.STREAM_MUSIC
and AudioManager.STREAM_NORMAL
- we are going to need to ticket it this to find a better way to get the volume.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -10,7 +10,8 @@ | |||
|
|||
public class TelemetryConstants { | |||
|
|||
public static final String OPERATING_SYSTEM = "Android - " + Build.VERSION.RELEASE; | |||
public static final String PLATFORM = "Android"; | |||
public static final String OPERATING_SYSTEM = PLATFORM + " - " + Build.VERSION.RELEASE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ericrwolfe This has been the value the library has been setting all along (this PR doesn't change that). Happy to change the formatting upon @mick confirmation to make sure the backend pipeline doesn't get affected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we havent been relying on attribute, 👍 for making it consistent with the spec
event.put(KEY_DURATION_REMAINING, durationRemaining); | ||
event.put(KEY_NEW_DISTANCE_REMAINING, newDistanceRemaining); | ||
event.put(KEY_NEW_DURATION_REMAINING, newDurationRemaining); | ||
event.put(KEY_SECONDS_SINCE_LAST_REROUTE, secondsSinceLastReroute); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newDistanceRemaining
, newDurationRemaining
, and secondsSinceLastReroute
are only required when the feedbackType=="reroute"
, they should be empty or null otherwise.
|
||
// Event keys | ||
public static final String KEY_EVENT = "event"; | ||
public static final String KEY_PLATFORM = "platform"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've removed platform from the spec since it can be derived from the operating system/SDK identifier.
public static final String KEY_DISTANCE_COMPLETED = "distanceCompleted"; | ||
public static final String KEY_DISTANCE_REMAINING = "distanceRemaining"; | ||
public static final String KEY_DURATION_REMAINING = "durationRemaining"; | ||
public static final String KEY_SECONDS_SINCE_LAST_REROUTE = "secondsSinceLastReroute"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've added a few additional keys to look out for in the spec:
General:
- simulation
- originalRequestIdentifier
- requestIdentifier
- originalGeometry
- originalEstimatedDistance
- originalEstimatedDuration
- audioOutput
Feedback:
- description
- userId
- feedbackId
- screenshot
- feedbackType (added more enum values)
- step (see below)
Reroute:
- feedbackId
- newDistanceRemaining
- newDurationRemaining
- newGeometry
- screenshot
- step (see below)
Step (Metadata about the current + upcoming step as a JSON object):
upcomingInstruction
(string)upcomingType
(string)upcomingModifier
(string)upcomingName
(Name of the street)previousInstruction
(string)previousType
(string)previousModifier
(string)previousName
(Name of the street)distance
(int, meters)duration
(int, seconds)distanceRemaining
(int, meters)durationRemaining
(int, seconds)
Cancel:
- arrivalTimestamp
Event version has been increased to 5
along with the above changes.
@zugaldia added a few notes on some of the relevant changes we've made to the spec |
I've made a few changes to address the PR comments but we still need to sync the fields for each event. Like #489 (comment) points out, we need to make sure we're up to date with the latest spec. |
Per chat with @cammace , he's gonna give it a pass to make sure we've included all items from the latest version of the spec. If so, we're good to 🚢 . Next would be mapbox/mapbox-navigation-android#113. |
I've added most of the missing keys but i'm not sure what we should do with the screenshot metadata. Do we already have a util for taking screenshots and encoding it? Should the encoding be done in this library or in the nav sdk? I would prefer the former. I'm also not completely sure whether the step metadata is being added correctly, @zugaldia could you check this? General:
Feedback:
Reroute:
Step (Metadata about the current + upcoming step as a JSON object):
Cancel:
|
…PluggedIn, batteryLevel, and connectivity
…LastReroute for a reroute type
Agreed - let's put this logic on the telemetry library, other clients could benefit from this functionality. Related: mapbox/mapbox-gl-native#8040.
Sure thing - could you point me at the code you want me to look at? |
I see it now, thanks ( Line 132 in 2145616
|
I've made a few fixes to missing metadata values, this PR should be good to merge now @zugaldia @ericrwolfe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bumping this since we need it in order to begin nav metric work. |
Expands the telemetry module with new navigation events.
cc: @ericrwolfe @cammace @danesfeder