Skip to content
Arezoo Nazer edited this page Mar 7, 2022 · 5 revisions

Welcome to the step by step tutorial on installing “ GameHub ” SDK.

I. Add Library

Add GameHub dependency to ‍dependencies‍ node in app/build.gradle

dependencies {
   implementation 'com.github.cafebazaar:GameHub:x.x.x'
}

II. Connect

The GameHub service allows your game to you connect Bazaar directly in order to participate players to sub-services. You should create an instance of “GameHub”. You can create it inside the onCreate method and then connect to the service anywhere.

@Override
protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   ...
   setContentView(R.layout.activity_main);
   gameHub = new GameHub();
   gameHub.connect(getApplicationContext(), true, (status, message, stackTrace) -> {
      Log.i("TAG", String.format("Connect => Status: %d, Message: %s, StackTrace: %s", status, message, stackTrace));
   });
}