Releases: pixlee/android-sdk
A bug-fix of missing a Parcelable variable
uploaderAdditionalFields: JSONObject was able to be passed to Activity and Fragment. This is fixed now.
Added PXLWidgetView having API, analytics, list , grid
improvement: PXLPhotoProductView (similar to Lightbox)
- Lifecycle, which is used to play&pause a video can be acquired from the view inside now.
A new view: PXLWidgetView (similar to Widget)
- automatically fire APIs[api/v2/albums/from_sku, api/v2/albums/{album_id}/photos] to get and display photos
- automatically fire Analytics[openedWidget, widgetVisible]
- provide grid (2 and more grid columns) and list layouts
UI Options
List
- turn infinite scroll on/off
- turn auto video playing on/off: play a video located at the top of the list
Grid
- Line Size between items
- Header
- Image URL: jpg / gif / png / webp / ect
- Customizable text: can change the color and size of each charector using SpannableString
Added a new Demo project
Added square_medium_url to PXLPhoto
Added square_medium_url to PXLPhoto
Added fields of PXLPhoto and postMedia API
A new field of PXLPhoto
#!java
public JSONObject uploaderAdditionalFields;
- uploaderAdditionalFields is from connectedUser that can be uploaded via
pxlKtxAlbum.postMediaWithFile()
orpxlKtxAlbum.postMediaWithURI
.
New addional fields for uploading content
- productSKUs: List // Optional
- categoryNames: List // Optional
- connectedUser: JSONObject // Optional
Example
- Option 1: Upload an image file
#!kotlin pxlKtxAlbum.postMediaWithFile( localMediaPath = "<local file path>", title = "uploaded from SDK-" + System.currentTimeMillis() + " using a file", email = "[email protected]", username = "replace this with your user name", approved = true, productSKUs = listOf("productA", "productB"), // Optional categoryNames = listOf("Clothing", "Shoes"), // Optional connectedUser = JSONObject().apply { // Optional put("name", "sample name") put("age", 24) put("points", JSONArray().apply { put(10) put(20) put(35) }) })
- Option 2: Upload an image url
#!kotlin pxlKtxAlbum.postMediaWithURI( photoURI = "<photo URI>", title = "uploaded from SDK-" + System.currentTimeMillis() + " using a file", email = "[email protected]", username = "replace this with your user name", approved = true, productSKUs = listOf("productA", "productB"), // Optional categoryNames = listOf("Clothing", "Shoes"), // Optional connectedUser = JSONObject().apply { // Optional put("name", "Sample name") put("age", 24) put("points", JSONArray().apply { put(10) put(20) put(35) }) })
Added global region id & global Automatic Analytics
region id
- setting up
regionId
can now be done globally in your application that extends Application. - if you use multi-region, you can set your region id here(see the example below) to get photos, a photo, and products available in the region.
#!kotlin
class YourApplication: Application {
override fun onCreate() {
super.onCreate()
// initializing SDK
PXLClient.initialize(<your api key>, <your secret key>)
PXLClient.regionId = your region id <--- set it if you use multi-region.
}
}
Automatic Analytics
- Enabling Automatic Analytics can now be done globally.
- If you want to enable auto-anlaytics, you need
PXLClient.autoAnalyticsEnabled = true
in your application that extends Application. Then, these PXLPhotoRecyclerView, PXLPhotoRecyclerViewInGrid and PXLPhotoProductView will fire analytics automatically in the right moments.
which Events are related to Automatic Analytics?
- 'VisibleWidget' and 'OpenedWidget': PXLPhotoRecyclerView and PXLPhotoRecyclerViewInGrid
OpenedLightbox
: PXLPhotoProductView
NOTICE: Please be aware that you need to remove your implementation of these analytics events you fire manually in your app. Because these views handle the events for you if you enable it by PXLClient.autoAnalyticsEnabled = true
.
#!kotlin
class YourApplication: Application {
override fun onCreate() {
super.onCreate()
// initializing SDK
PXLClient.initialize(<your api key>, <your secret key>)
PXLClient.autoAnalyticsEnabled = true <----- This activates this feature
PXLClient.regionId = your region id <--- set it if you use multi-region.
}
}
class YourActivityOrFrament: Activity or Fragment {
// load this when you need
func setup() {
pxlPhotoProductView.setContent(...)
}
}
Added automatic analytics to UI components
This update is for those who use our UI components and want to avoid implementing as many analytics as possible.
UI components now have an option of firing analytics events automatically. FYI, loadmore
has always been fired automatically on album class
(Java: PXLAlbum, Kotlin: PXLKtxAlbum) when getting a list of photos.
However, for the analytics events such as actionClicked
, addToCart
, and conversion
, you still need to manually implement it.
Supported automatic Analytics events
PXLPhotoRecyclerViewInGrid (similar to Widget)
- VisibleWidget
- OpenedWidget
PXLPhotoRecyclerView (similar to Widget)
- VisibleWidget
- OpenedWidget
PXLPhotoProductView (similar to Lightbox)
- OpenLightbox
How to enable it?
PXLPhotoRecyclerViewInGrid
#!kotlin
// alternative: pxlPhotoRecyclerViewInGrid.enableAutoAnalytics(pxlKtxAlbum, "photowall") // newly added one
pxlPhotoRecyclerViewInGrid.enableAutoAnalytics(pxlKtxAlbum, PXLWidgetType.photowall) // newly added one
pxlPhotoRecyclerViewInGrid.initiate(...) // existing code, where you set up the photo list data and customize UI elements.
PXLPhotoRecyclerView
#!kotlin
// alternative: pxlPhotoRecyclerView.enableAutoAnalytics(pxlKtxAlbum, "photowall") // newly added one
pxlPhotoRecyclerView.enableAutoAnalytics(pxlKtxAlbum, PXLWidgetType.photowall) // newly added one
pxlPhotoRecyclerView.initiate(...) // existing code, where you set up the photo list data and customize UI elements.```
PXLPhotoProductView
#!kotlin
// set one of your region ids if you have.
val regionId: Int? = null
// alternative: pxlPhotoProductView.enableAutoAnalytics(regionId) // newly added one
pxlPhotoProductView.enableAutoAnalytics(regionId)// newly added one
pxlPhotoProductView.setContent(...) // existing code, where you set up the photo data and customize UI elements.```
Added region id
This release is for those who have multi regions. You can now get photos from a specific region and differentiate analytics events by region.
initiation
#!Kotlin
val pxlKtxAlbum = PXLKtxAlbum(context)
val searchId = PXLKtxBaseAlbum.SearchId.Album("<your ALBUM ID>")
pxlKtxAlbum.params = PXLKtxBaseAlbum.Params(
searchId = searchId
)
pxlKtxAlbum.params = PXLKtxBaseAlbum.Params(
searchId = searchId,
perPage = 30,
filterOptions = PXLAlbumFilterOptions().apply {
hasPermission = true
hasProduct = true
// ... there's more
},
sortOptions = PXLAlbumSortOptions().apply {
sortType = PXLAlbumSortType.RECENCY
descending = true
// ... there's more.
},
regionId = <Optional: your region id(Int)> //<-------------- HERE is where you need to add your region id (Optional). If you don't know your region ids, please ask your account manager to give you it.
)
region id
related APIs
Get the first page
#!Kotlin
val result = pxlKtxAlbum.getFirstPage()
Get the next pages
#!Kotlin
val result = pxlKtxAlbum.getNextPage()
Get PXLPhoto from default region
- if you have multi regions, your default region is set on the server. to get more detail about your default region, please reach out your customer success manager
#!Kotlin.coroutines
val albumPhotoId:String = <one of your album photo ids>
val result:PXLPhoto = pxlKtxAlbum.getPhotoWithId(albumPhotoId)
Get a PXLPhoto from a region
- before firing this, you must basically add region when setting up pxlKtxAlbum.params
#!Kotlin.coroutines
val albumPhotoId:String = <one of your album photo ids>
val result:PXLPhoto = pxlKtxAlbum.getPhotoFromRegion(albumPhotoId)
all analytics APIs are related to region id
- Step 1: get through the initiation process at the top of this release note to set
region id
- Step 2: fire analytics APIs
UI Components
This is the same version from 1.5.0-rc02.
For more information please check the document.
Downgraded ExoPlayer from 2.12.1 to 2.8.2
Downgraded ExoPlayer from 2.12.1 to 2.8.2
Replaced the old video player with ExoPlayer
What's improved
- ExoPlayer is now the video player in the SDK.
- The video loading speed is faster.
- The problem of content not displaying intermittently is fixed.
- The issue of playing the video background is fixed.
What's changed
PXLPhotoProductView and PXLPhotoRecyclerView
Play and stop the video
- Option 1: Automatic using androidx.lifecycle.Lifecycle(Jetpack)
- You just update the SDK the this version, the SDK will work automatically.
- Option 2: Manual (use this if you want to play, stop and release the video when you need)
- we renamed from playVideo() to playVideoOnResume()
- we renamed from stopVideo() to stopVideoOnPause()
- we added playVideoOnStart()
- we added stopVideoOnStop()
PXLPhotoView
- we removed releaseAllVideos()
- you use pxlPhotoView.playVideo() to play the video
- you use pxlPhotoView.pauseVideo() to pause the video