(Previous: Adori Android SDK: Sample App)
Advanced Usage
Advanced usage is only advised for Adori SDK customers who want to customize and build their own tag views. Adori does not encourage this and suggests using AdoriTagsView
for showing tags.
Note
Adori Studio allows audio creators to compose their tags and preview them before embedding into audios. AdoriTagsView
is always kept in sync with Adori Studio tag previews and recieves updates as and when newer tag types and visualizations are supported. By using AdoriTagsView
your app will be able deliver the exact experience composed the creators and support newer tag types as and when they are added.
AdoriTagServiceListener
AdoriTagServiceListener
provides an interface method that provides the current experience that needs to be served. You can use this interface to build their own UI based on the experience that is obtained from this from the listener.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | import com.adorilabs.sdk.ui.AdoriTagServiceListener; public class PlayerView extends AppComaptActivity implements AdoriTagServiceListener { AdoriTagsService adoriTagsService; @Override protected void onCreate(Bundle savedInstanceState) { // setup views // Initialize adoriTagsService //Set listener to the adoriTagsService object after its initialized adoriTagsService.addListener(this); } /** * Called when a tag is served. * <p> * Use this method to receive experiences to be served. * Using the provided {@link Experience}, render customized tag views on the screen. * * To quickly get started use {@link com.adorilabs.sdk.ui.UI.AdoriTagsView} * which implements this interface and renders tag views in the given area. * * This method may be called even before {@link AdoriTagsService#addListener} returns * * @param experience The {@link Experience} of the tag which * has been served. */ @Override public void serveTag(Experience experience) { //Use the experience Object here to render the UI accordingly. } /** * Called when the navigation state is updated. * <p> * Navigation state indicates the availability of tags. It offers * 2 boolean variables to state whether there are tags after/before the * current audio progress. * It can be used show/hide navigation controls in tag view. * * This method may be called even before {@link AdoriTagsService#addListener} returns * * @param before The boolean variable which indicates whether there * are tags before the current point of the audio. * @param after The boolean variable which indicates whether there * are tags after the current point of the audio. */ @Override public void navigationStateUpdated(boolean before, boolean after) { //Navigation state indicates the availability of tags. It offers //2 boolean variables to state whether there are tags after/before the //current audio progress. } /** * Called when a tag has timed out. * * @param experience The {@link Experience} of the tag which * has been served. */ @Override public void timeOutTag(Experience experience) { //Use this method to hide experience in the parameter. } /** * Called when the audio is completed * <p> * * This method can be used to show a summary of all tags in the audio. * * @param experiences The array of Experiences that was served for * the episode. */ @Override public void servedTags(List<ExperienceWithEpisode> episodeExperiences) { //Called when the audio is completed with the list of all experiences that were served. } /** * Called when a new instance of player is set on {@link AdoriTagsService}. * <p> * Use this callback to listen to changes in the player used by {@link AdoriTagsService}. * * This method may be called even before {@link AdoriTagsService#addListener} returns * * @param player Instance of {@link Player}. * Value may be `null` if player is not set yet or if the player is removed. */ @Override public void setPlayer(Player player){ // update your local reference to the player } } |
Note:
AdoriTagsView
also implements AdoriTagServiceListener
to show/hide the tag experiences.
Next Up: Adori Android SDK FAQs