Google Maps Navigation Instructions

I am looking for a way to get directions from Maps Navigation. Currently I think the only possible way is to read the notification data which is placed at the top using Maps Navigation. My reason is this is the only way out of this post. I tried to get the data using the OnNotificationPosted method, but I cannot find the directions data in the StatusBarNotification object ...

Does anyone have a solution or a better idea on how to achieve this.

+3


source to share


1 answer


You can implement NotificationListenerService to get the content of the Google Maps route route. Unfortunately Maps do not share common attributes in the StatusBarNotification. However, maps are used to display the contents RemoteViews

. You can send this data over Broadcast for this activity and eventually add content to your existing view:



RemoteViews remoteView = intent.getParcelableExtra(id);
if (remoteView != null) {
    ViewGroup frame = (ViewGroup) findViewById(R.id.layout_navi);
    frame.removeAllViews();
    View newView = remoteView.apply(getApplicationContext(), frame);
    newView.setBackgroundColor(Color.TRANSPARENT);
    frame.addView(newView);
}

      

0


source







All Articles