Example - Get Friends

This example shows how to get information about my friends.

String JOINED_SERVER = "https://joinedserver.geomobile.de:7012/friendfinder";
String JOINED_API_KEY = "5923078164";

/* CREATE CLIENT */
JOClient client = JOClient.createJoinedClient(JOINED_SERVER, JOINED_API_KEY);

/* LOGIN USER */
JOUser user = client.login("username", "password");

/* GET FRIENDS */
List<JOFriend> friends = friends = client.getFriends(user);

/* SHOW FRIEND INFORMATION */
for (JOFriend friend : friendsToAccept)
{
  System.out.println("Nickname: " + friend.getNickname());
  System.out.println("Identifier: " + friend.getId());  
  System.out.println("Status (true=online, false=offline): " + friend.isActive());
  System.out.println("Last Known Position (Latitude): " + friend.getLatitude());
  System.out.println("Last Known Position (Longitude): " + friend.getLongitude());
}

If the search process fails, the client throws an exception. All potential exceptions are documented in the Java API Documentation of the Joined API for Android and can be found here.

An example implementation of the example is part of the Joined API for Android project and can be found here.