Search code examples
androidgraphqlgraphql-java

How can I use from GraphQl in android?


I need to a simple example for use GraphQl in android .

How can I use from GraphQl in android (tutorial).


Solution

  • In order to use GraphQL (in general), you need two things:

    1. A GraphQL server

    There are a few ways how you could go about this. Of course, you could simply go and implement one yourself in any server-side language you like. Other (faster) approaches are to take advantage of existing tooling and generate a GraphQL API using services like graphql-up or create-graphql-server or even services like Graphcool (disclaimer: I work for them).

    2. A GraphQL client library

    Though this one isn't strictly necessary and you could also simply interact with the GraphQL server through plain HTTP (sending your queries and mutations in the body of POST requests), it is certainly beneficial to use existing tools that take repetitive work like caching or UI integrations off your shoulders. One of the most popular GraphQL clients right now is Apollo, and they're very actively working on a version for Android as well. However, this hasn't been officially released yet. So, you either have to use their existing development version of chose the former approach using plain HTTP for now.