String email = “email@example.com”;
String password = “3bc8f72e95a9”;
Session session = client.authenticateEmail(email, password).get();
System.out.format("Session: %s ", session.getAuthToken());
in this code When use in android studio it dont Show get() function.
@surajchopra How do you import the client into your Android Studio project?
You can see the function in the Java client codebase which uses a ListenableFuture
object:
https://github.com/heroiclabs/nakama-java/blob/master/src/main/java/com/heroiclabs/nakama/Client.java#L240-L246
You can see that a ListenableFuture
contains a .get()
method:
https://guava.dev/releases/21.0/api/docs/com/google/common/util/concurrent/ListenableFuture.html
This is also confirmed within our test cases which use it to fetch the result of the network request on the main thread:
https://github.com/heroiclabs/nakama-java/blob/master/src/test/java/com/heroiclabs/nakama/AuthenticateTest.java#L56
1 Like
i have download the .jar client file from github and include in android studio . when i use the
implementation ‘com.github.heroiclabs:nakama-java:’
then error come that
Failed to resolve: com.github.heroiclabs:nakama-java:
Show in Project Structure dialog
Affected Modules: app
please help to add listenablefuture
@surajchopra If you want to download the JAR and include it rather than via the dependency resolver with Maven or Gradle you should download and use the fat JAR which includes all dependencies within the JAR package:
https://github.com/heroiclabs/nakama-java#getting-started
Have a look at the getting started section of the README which covers the fat JAR example.
@ surajchopra
Could you see if you get better results with the latest commit in https://github.com/heroiclabs/nakama-java/pull/46/commits?
You’ll need to look at the updated README.md
in that pull request for a new Maven coordinate scheme.