Skip to content

Instantly share code, notes, and snippets.

@jbui1
Last active August 29, 2015 14:20
Show Gist options
  • Save jbui1/72cce16422f67c8a86d2 to your computer and use it in GitHub Desktop.
Save jbui1/72cce16422f67c8a86d2 to your computer and use it in GitHub Desktop.
Project 5 Markdown

"Or heritage and ideals, our code and standards - the things we live by and teach our children - are preserved or diminished by how freely we exchange ideas and feelings." -Walt Disney

Download Application: https://play.google.com/store/apps/details?id=edu.ggc.jbui1&hl=en

##Intro

When I started my project, I thought it would have been a simple "create and run" application with no need for anything special besides a few imported APIs. Man was I wrong. My application as a whole was a walking danger to Riot Games and in order to do something I would have to give up my personal account in return for a "Developer's Key."

Riot Developers

When I registered for Riot's API I gained access to all of whatever they had to offer. Anything from Champions to User Information it was all there. I admit I was pretty excited when it came to accessing this kind of information. I mean playing the game I love and developing a working applcication that will allow me to go out and have a life while carrying a piece of my game with me? Sounds to me like a slice of heaven.

Full API Reference

Riot Guidelines

After registering for Riot's Developer key, my application was already 15% complete. I already had all of the information I needed and the only thing left was to implement it and run with the idea. However, mid way into developing the original application (which was a summoner tracker) I came across something unfortunate. I could not disclose the locations of other players through the app simply because it was against Riot's ToS (Terms of Service). In order to move forward from this very large hurdle I had to tweak my original plans. So I got to thinking. Instead of a tracker, why not have a chat system. I have a chat messenger already on my phone (KiK) that allows me to chat with people on my friends list. Why not have one for League of Legends.

##Application Process

"No one saves us but ourselves. No one can and no one may. We ourselves must walk the path.” Paul Carus, summarized from the Dhammapada, verse 165"

LoLSummoner

Developing the code for a chat system would have been a lot simplier with Riot's API because it had references to things like a player's name, their friends, and their status online. So it makes sense to try and develop an application for a chat. With a little digging I found a forum on how a chat would work and the interaction needed in order to migrate a message from device to device. Surpisingly they only needed a few lines of code with references to other classes.

Riot Games' API provided lots of classes needed for the application to properly. Inside the API it offered classes with information like champions, runes, masteries, items and much more. These classes were important in how my application would run. The API itself was a zip file filled with classes and methods that were at the developer's disposal.

private Chat getChat() {
		if (chat == null) {
			chat = ChatManager.getInstanceFor(con).createChat(getUserId(),
					new MessageListener() {

						@Override
						public void processMessage(Chat c, Message m) {
							if (chat != null && listener != null) {
								listener.onMessage(instance, m.getBody());
							}

						}
					});
		}
		return chat;

Using the API was simple using call methods and adding them into the application. One challenge was making the imports work together instead of separately and making sure they did not mash together and cause the application to crash. One way I handled the problem was by working on the chat slowly, adding imports where I thought they were needed and then deleting them when they were not used. This allowed me to make sure all of the classes were working together and make sure nothing crashed.

Another complication I came across was making my application more user friendly. The application in its beta stage was not friendly at all. Shoving all of the application's activity into one screen. In order to solve this problem I did list views instead of bombarding the user with information. I used the game's API to help split the list views. This allowed me to dedicate one section to friends that are online and another section to chat messages.

##Conclusion

The things I learned:

  1. APIs help a lot.
  2. Making an application with many classes can be hard but not impossible.

##References: We keep moving forward, opening new doors, and doing new things, because we're curious and curiosity keeps leading us down new paths. -Walt Disney

https://developer.riotgames.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment