Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Android Nougat compatibility: onstart/onstop on MapView - #6830

Merged
tobrun merged 4 commits into
masterfrom
5910-move-listener-logic-for-nougat
Oct 31, 2016
Merged

tobrun merged 4 commits into
masterfrom
5910-move-listener-logic-for-nougat

Conversation

@tobrun

@tobrun tobrun commented Oct 26, 2016 •

Copy link
Copy Markdown
Member

Closes #5910.

This PR makes the SDK compatible with Android Nougat by moving the location listener logic to the Activity onStart/onStop instead of onResume/onPause. This change is needed to support multiwindow feature introduced in Android nougat.

To make migration easier for users, I opted to implement an exception that is thrown when the newly introduced MapView#onStart or MapView#onStop isn't called. It's similar to SuperNotCalledException from the Android SDK. This will enforce Users to migrate to the new methods.

Review @ivovandongen

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Oct 26, 2016
@tobrun tobrun added this to the android-future milestone Oct 26, 2016
@mention-bot

Copy link
Copy Markdown

@tobrun, thanks for your PR! By analyzing the history of the files in this pull request, we identified @bleege, @cammace and @ivovandongen to be potential reviewers.

@tobrun

tobrun commented Oct 26, 2016

Copy link
Copy Markdown
Member Author

Generated the activity sanity tests locally to validate changes:

screen shot 2016-10-26 at 15 18 21

@tobrun

tobrun commented Oct 26, 2016

Copy link
Copy Markdown
Member Author

Target SDK set to Nougat has landed on master with #6390, this PR is ready for review.

@zugaldia zugaldia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per chat, let's also add a line to the CHANGELOG.md file stating that v.5.0.0 will target and support N.

@tobrun

tobrun commented Oct 26, 2016

Copy link
Copy Markdown
Member Author

@zugaldia updated changelog.md as requested.

@zugaldia

Copy link
Copy Markdown
Member

@tobrun Thanks. Note that I haven't reviewed the rest yet, I'll let @ivovandongen do it per OP.

/**
* You must call this method from the parent's {@link Activity#onPause()} or {@link Fragment#onPause()}.
*/
@UiThread

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're doing a semver release anyway. Can't we remove this all together? Or at least deprecate it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented this way to make sure users are correctly migrating from an older version. If a user doesn't implement the new onStart/onStop, they will not be able to receive any location updates. This is something that will go unnoticed during "migration" and will only show when you are trying to a location fix. I have no problem with removing this but I felt it was an improvement over the other possible UX here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tobrun
tobrun merged commit ccc3964 into master Oct 31, 2016
@tobrun
tobrun deleted the 5910-move-listener-logic-for-nougat branch October 31, 2016 12:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Android Mapbox Maps SDK for Android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants