seatsio-android allows rendering seats.io seating charts or the event manager inside an Android application.
Android SDK version 24 and upwards is supported (which corresponds to Android 7 - Nougat)
First add jitpack as a repository in build.gradle
:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Then you can refer to seatsio-android as a regular package:
dependencies {
implementation 'com.github.seatsio:seatsio-android:9.0.0'
}
seatsio-android offers 2 custom views: SeatingChartView
and EventManagerView
. Those are WebViews, which need internet access. Make sure you add the following permission to AndroidManifest.xml
<manifest ...>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
Your build.gradle
also needs to specify a targetCompatibility
of 1.8 or higher:
android {
compileOptions {
targetCompatibility 1.8
}
}
All configuration parameters are documented at https://docs.seats.io/docs/renderer-embed-a-floor-plan
// this code should be inside an Activity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SeatingChartConfig config = new SeatingChartConfig()
.setPublicKey("<yourPublicKey>")
.setEvent("<yourEventKey>");
setContentView(new SeatingChartView(Region.EU, config, getApplicationContext()));
}
SeatingChartConfig config = new SeatingChartConfig()
.setPublicKey("<yourPublicKey>")
.setEvent("<yourEventKey>");
.setPricing(
new PricingForCategory("Ground Floor", new SimplePricing(34)),
new PricingForCategory("Balcony", new SimplePricing(50))
)
.setPriceFormatter(price -> price + "€");
setContentView(new SeatingChartView(Region.EU, config, getApplicationContext()));
SeatingChartConfig config = new SeatingChartConfig()
.setPublicKey("<yourPublicKey>")
.setEvent("<yourEventKey>");
.setPricing(
new PricingForCategory("Ground Floor",
new TicketTypesPricing(
new TicketTypePricing(40, "Child"),
new TicketTypePricing(50, "Adult")
)),
new PricingForCategory("Balcony",
new TicketTypesPricing(
new TicketTypePricing(60, "Child"),
new TicketTypePricing(70, "Adult")
)))
.setPriceFormatter(price -> price + "€");
setContentView(new SeatingChartView(Region.EU, config, getApplicationContext()));
SeatingChartConfig config = new SeatingChartConfig()
.setPublicKey("<yourPublicKey>")
.setEvent("<yourEventKey>")
.setOnObjectSelected((object, ticketType) -> /* do something */)
.setOnObjectDeselected((object, ticketType) -> /* do something */);
setContentView(new SeatingChartView(Region.EU, config, getApplicationContext()));
SeatingChartConfig config = new SeatingChartConfig()
.setPublicKey("<yourPublicKey>")
.setEvent("<yourEventKey>")
.setObjectLabel("object => object.labels.own"); // must be a valid Javascript function
setContentView(new SeatingChartView(Region.EU, config, getApplicationContext()));
// this code should be inside an Activity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EventManagerConfig config = new EventManagerConfig()
.setSecretKey("<yourSecretKey>")
.setEvent("<yourEventKey>")
.setMode(MANAGE_OBJECT_STATUSES)
.setLanguage("nl");
setContentView(new EventManagerView(Region.EU, config, getApplicationContext()));
}
Documentation for the event manager is available at https://docs.seats.io/docs/event-manager