question

Scott A. Conger avatar image
Scott A. Conger asked

Barcode

I've created Firefly plugin that receives a barcode. (FacetType.BARCODE) But it's also showing when a TV show or book is scanned. Is that intentional or should I have something to filter out anything but a barcode scan? If it's intentional, wont this list of apps receiving information from Firefly get to be a really long list overtime as vendors adopt it? The app is only used for a very specific use with RSWide39. Is there a way to weed out all other numbers and barcodes? Not even show the option to launch the app, if it's not that barcode? It would never need to receive a number from a book, movie, tv, etc...
fire phone
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Kevin@Amazon avatar image
Kevin@Amazon answered
Hi Scott, At this point, there is not an ability in the external SDK to suppress a plugin based on the presence a certain facet or attributes of a certain facet, or based on the manner in which the identification was made (i.e. barcode scan vs image match vs audio match). Firefly will always return both a BarcodeFacet and ProductDetailsFacet if a product is scanned, either by image match or barcode match or audio match. If that product is a book or music or video, those facets will be added as well. If the user scanned by barcode, and there is no corresponding product in the amazon catalog, then only the BarcodeFacet will be returned. This can be used to help reduce the times when the label is clickable in the current SDK level: For the current SDK level, you should return null from your plugin component when the plugin is not relevant, and the entry will show with a non-clickable label that indicates the plugin has no results. For example, you could add an optional clause to their DigitalEntityFilter to optionally select MUSIC | BOOK | VIDEO facets, and then return null from your resolver if that facet exists (i.e. if the identified item was a book). I.e. // in Plugin class public DigitalEntityFilter() { DigitalEntityFilter deFilter = new DigitalEntityFilter() deFilter.addRequiredFacets(FacetType.BARCODE); deFilter.addOptionalFacets(FacetType.MUSIC, FacetType.BOOK, FacetType.MUSIC); return deFilter; } // in resolver class public Facet resolve() { DigitalEntity de = getDigitalEntity(); if (de.getFacet(FacetType.MUSIC) != null || de.getFacet(FacetType.BOOK) != null || de.getFacet(FacetType.VIDEO != null)) { //return null as this is not an identification we are relevant for return null; } …. } Similarly, you could addOptionalFacet(FacetType.PRODUCT), and do fine grained filtering based on the Department enum returned from ProductDetailsFacet.getDepartment(), returning null in your plugin component if the department is not relevant.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.