How to Build a Clean Architecture GraphQL App With Kotlin - Android Studio Tutorial

Поделиться
HTML-код
  • Опубликовано: 14 окт 2024
  • With GraphQL you can define what data you want to get from an API to avoid getting a lot of fields you don't need. This optimizes your network traffic and battery consumption for your app. In this video, you'll learn how you can make use of this in Android.
    ⭐ FEBRUARY SALE: Get 20% discount on ALL my courses with FEBRUARY20:
    ttps://pl-coding.com/premium-courses?
    Get to the countries API here:
    studio.apollog...
    Get the initial source code for this video here:
    github.com/phi...
    Get the final source code for this video here:
    github.com/phi...
    Regular programming advice on my Instagram page: / _philipplackner_
    Checkout my GitHub: github.com/phi...

Комментарии • 98

  • @elohimalves
    @elohimalves Год назад +47

    You're not from this world! You're so helpful with your videos! ❤️

    • @PhilippLackner
      @PhilippLackner  Год назад +4

      Thank you🙌❤️

    • @nastenkaoo
      @nastenkaoo Год назад

      danke mein mann

    • @levp1801
      @levp1801 Год назад

      @@PhilippLackner
      What is the full command here? 9:40

  • @danielayodeji3641
    @danielayodeji3641 Год назад +7

    I await for this. Thank you for all what you do for the Android community.

  • @ryallnovember2664
    @ryallnovember2664 Год назад +32

    At 09:40 his face cam covers the url. here is the full command --> ./gradlew :app:downloadApolloSchema --endpoint='paste-apollo-url-here' --schema=app/src/main/graphql/schema.graphqls

  • @somaiadamlakhi4079
    @somaiadamlakhi4079 Месяц назад

    You are amazing man , you have a great effect in my work experience as an Android developer , keep going !

  • @anb4351
    @anb4351 Год назад +14

    at ~ 9:20 we can never completely see the terminal ./gradlew command you exucuted because of your face blocking the view
    you should paste it in description and also explain better / in more details on how it works

  • @Nick-cx4rs
    @Nick-cx4rs Год назад +1

    Bro since i started android i see you more than my family :)

  • @hellodevs
    @hellodevs Год назад +7

    Thank you for always showing amazing content 🇧🇷🇧🇷🇧🇷

  • @frankleth9380
    @frankleth9380 Год назад

    Congratulation 100.000 Follower, cool

  • @tonnie7079
    @tonnie7079 Год назад +1

    I learnt a new trick today: _state.update { it.copy()} is dope. Before I was doing _state.value = _state.value.copy() which is feels repetitive . You are a Legend!

  • @Abelmengesha-sp6lv
    @Abelmengesha-sp6lv Год назад

    39:50 you clicked my country there! Love and respect from countries[39:50] Philip!

  • @gugapadilha6945
    @gugapadilha6945 Год назад

    Going for the 100k! congrats dude you deserve the best :)

    • @PhilippLackner
      @PhilippLackner  Год назад

      🙌🙌❤️

    • @gugapadilha6945
      @gugapadilha6945 Год назад

      ​@@PhilippLackner btw do you mind to send me the full path that you write on terminal in 9:19? your webcam got in front of it hehe

  • @AmitJayant
    @AmitJayant Год назад

    I like how your t shirt changed magically at 1:33

  • @flowzk921
    @flowzk921 Год назад

    Another MasterClass from Philipp! Many Thanks!!!

  • @RahulKumar-un6ur
    @RahulKumar-un6ur Год назад

    Fantastic and crystal clear explanation. Thank you very much 🙏.

  • @markusmcgee
    @markusmcgee Год назад +3

    Good explanation of not just GraphQL but on JetPack state and Hilt. I need to tighten up how I use JetPack state based on your video. Extremely good job.

  • @burakkaraduman6394
    @burakkaraduman6394 Год назад +1

    It's a great video. There aren't many videos about this thank you. Why did we create country classes when we already have the opportunity to create custom queries in GraphQL?

  • @theophilus494
    @theophilus494 Год назад

    You ve just blown my mind with this.. thanks boss

  • @osisuper98
    @osisuper98 Год назад

    Always learning from you Philipp.

  • @AmitVerma-iq3oe
    @AmitVerma-iq3oe 9 месяцев назад

    Thanks for making such a video, It helps a lot, keep it up 👏

  • @bestoftheinternet3421
    @bestoftheinternet3421 Год назад

    Thanks for putting out content on complex topics

  • @ИгорьВялков-я1ф
    @ИгорьВялков-я1ф Год назад +10

    Thank you so much for interesting topics. Please don't stop to do some non-standart stuff sometimes

  • @jefissuu
    @jefissuu Год назад

    Thanks, Philipp, for amazing content 🇧🇷

  • @mithileshdhupia2533
    @mithileshdhupia2533 Год назад

    I was waiting for this for so long... Finally...

  • @celik_m
    @celik_m Месяц назад

    Nice explanation, tnx!

  • @sh3r1p49
    @sh3r1p49 Год назад

    Thank you so much Philipp! This helps me a lot! :)

  • @rileyfarro6801
    @rileyfarro6801 Год назад +1

    Great video! I can sense that your new premium course might be about creating a ktor backend with grapql then KMM or just android 😁

    • @PhilippLackner
      @PhilippLackner  Год назад

      Actually not, I think GraphQL is a bit too niche for that 😁

  • @ramanpreetkaur5751
    @ramanpreetkaur5751 6 месяцев назад

    Hi, Great Philipp, but could you please explain how to do it without use cases, can i directly access countryClient in viewModel?

  • @SiamakAshrafi
    @SiamakAshrafi Год назад

    LOL ... just finished my multi-module clean arch Android GraphQL project ... Needed this a week ago 🙂

    • @SiamakAshrafi
      @SiamakAshrafi Год назад +1

      If you turn on Apollo cache you get a Flow and it looks more like the RoomDB

  • @jayshartzer844
    @jayshartzer844 Год назад

    Awesome! I use GraphQl and this tutorial helps with the Apollo client (currently manual creation of DTOs due to lower min SDK).
    Getting closer to touching every aspect of Android development! OpenID/OAuth 2 integration soon?

  • @miansarimhameed6248
    @miansarimhameed6248 Год назад

    Amazing tutorial ♥

  • @farouksabiou
    @farouksabiou 9 месяцев назад

    Thank you Philipp 👏

  • @dzartxstudio
    @dzartxstudio Год назад

    Love it ❤️
    From Algeria

  • @МаксимСысоев-р5в
    @МаксимСысоев-р5в Год назад +1

    Thank you so much for your work! It's really nice content.
    Few tips if you don't mind:
    - You could provide only ApolloClient in your Dagger Module and use @Binds for map CountryClient to ApolloCountryClient. So you can use just constructor @Inject for UseCases.
    - Why did you create CountryClient in domain package? It seems that it should be in data layer too. At your solution data layer knows about domain layer but is not good and it is break Clean Architecture approach.
    But anyway it was nice video, thanks!

    • @PhilippLackner
      @PhilippLackner  Год назад +1

      Seems like you misunderstood something about CA then, domain is the innermost layer and is allowed to be accessed by all other layers (which is the reason CountryClient has to be in domain).
      So domain shouldn't know about data, but both presentation and data can access domain

    • @МаксимСысоев-р5в
      @МаксимСысоев-р5в Год назад

      @@PhilippLackner ok, maybe I missed it. Thanks.

  • @bahaaalkhateeb6583
    @bahaaalkhateeb6583 Год назад

    Sound great, but does the API or server-side need to handle anything to make this work?

  • @McMouse88
    @McMouse88 Год назад

    Thank Philipp, create another one about gRPC, please

  • @sonamyadav0333
    @sonamyadav0333 Год назад +1

    Thanks Phillip for the great work. Great tutorial with great explanation. Appreciate that you take time explaining things in details. Great job. Thank you.

  • @JuanDanielOrnella
    @JuanDanielOrnella Год назад

    Amazing bro!

  • @jayantkumar1954
    @jayantkumar1954 Год назад

    Wow amazing 😍❤️

  • @elzubairelseddeg4047
    @elzubairelseddeg4047 Год назад

    Hello sir
    First, thanks for your great channel
    Secondly, can you make a video on how to build a small application from within which you only download the details of the application or features that you want?
    Thanks again

  • @yasserakbbach708
    @yasserakbbach708 Год назад

    22:21 this made my day about use cases :V

  • @mrdeveloper4438
    @mrdeveloper4438 Год назад

    Nice one phillip...

  • @elangovankr110
    @elangovankr110 Год назад

    Very interesting topics ❤

  • @BapeRuLLZ
    @BapeRuLLZ Год назад +2

    I wonder how well this scales. I feel like with this approach you need to be at least somewhat familiar with how the data is structured on the backend whereas with a rest api you can view it as a blackbox ("I dont care how or where you get it from, just give me this and that"). You can create rest api calls on a per view/screen basis (organized by sub-urls) which only gives you what you need in one package with one call, thus saving phone resources and bandwidth. I feel like with graphql you either have data related logic on client side which maybe shouldn't be there or you use it exactly like a well implemented rest api. What am I missing here?

    • @ChrisAthanas
      @ChrisAthanas Год назад +1

      There are many systems that have API's that grow over time from the Rest implementation. Most backends are not well designed with the client in mind, not delivering the minimal payload. Its just not been a priority for the BE community. GraphQL is a trade-off solution for these older systems where they can put a layer between the BE and the FE that allows the FE to reduce the payloads on the network, but the tradeoff is that the BE needs to be implemented that can perform those BE calls in a GraphQL way.
      If you are greenfielding a project and you know you will creating it for mobile, GraphQL is likely overload, as you can restrict your API's for mobile, or have separate calls for mobile.

  • @strok777
    @strok777 14 дней назад

    Is there any way to generate the DTOs automatically without having ro create them manually?

  • @hdkloh6857
    @hdkloh6857 7 месяцев назад

    These auto generated model classes aren't parcelable, so how can we transfer data between different screens ?

  • @umnikya7874
    @umnikya7874 Год назад

    Cool! I started from initial project and finish it! All works! Great! 🙂

  • @bohdanserdyuk5959
    @bohdanserdyuk5959 Год назад

    Many thanks for your work, Philipp! Would be great to have masterclass from you of working with content provider(for both cases of collecting and sharing data by app)

  • @samdroid37
    @samdroid37 Год назад

    you absolutely rule

  • @Tuligarnio
    @Tuligarnio Год назад

    What's the difference between a repository and a client?

  • @twinspast141
    @twinspast141 Год назад

    hi philip.. im trying to Buy some of your course but idk how to calculate the fees , because in my visa card i have 250 euros but when i want to buy your 99 course the page tells me that i don't have money enough !! WTF Im from argentina! Can u help me pls? because im trying to buy you course every time but idk why i cant!!

  • @nicolascambuy1507
    @nicolascambuy1507 Год назад

    Nice!

  • @levp1801
    @levp1801 Год назад +3

    What is the full command here? 9:40

    • @aldiguizot
      @aldiguizot Год назад

      Still waiting the full command

    • @levp1801
      @levp1801 Год назад

      @@aldiguizot i actually never seen him fixing his mistakes in comments :(

    • @Shamil_gulmetov
      @Shamil_gulmetov Год назад

      Kick when they say please

  • @renzcarlosalanga6077
    @renzcarlosalanga6077 Год назад

    Mapping a list every time you fetch a data is kind of resource intensive specially when you have a large data set

    • @PhilippLackner
      @PhilippLackner  Год назад

      Did you measure it? If yes, does it effect user experience? No? Then it doesn't matter 😄
      There's a common saying that Premature optimization is the root of all evil

    • @renzcarlosalanga6077
      @renzcarlosalanga6077 Год назад

      @@PhilippLackner hmm yes loading times is much longer. Ill keep that in mind

    • @renzcarlosalanga6077
      @renzcarlosalanga6077 Год назад

      @@PhilippLackner if you implement paging I think you wont notice the difference

  • @thousandcranes3045
    @thousandcranes3045 Год назад

    Wait remind me why do we need to provide usecases through modules? It's our own classes and not like ViewModel or Activities or like third-party classes such as Room DB object. Can't we just @Inject them?

    • @PhilippLackner
      @PhilippLackner  Год назад

      No, how should dagger know how to create our own classes 🤔

    • @thousandcranes3045
      @thousandcranes3045 Год назад

      @@PhilippLackner eh im pretty sure u can constructor inject them, we do it all the time in our code base. Well we use Dagger2 but im pretty sure Hilt does the same since its basically an extension of it. The only time we cant constructor inject them directly is when we need to inject viewmodel/presenter to activity/fragment, or when we inject stuffs like third party object like Room

  • @dmitriymorozov2680
    @dmitriymorozov2680 Год назад

    I love your videos. Could you dive a bit deeper into the topic and show how to handle error handling, pagination, interceptors?

  • @kairoseini7183
    @kairoseini7183 7 месяцев назад

    Hey Philipp, Please can you tell me how to pdf file upload in graphql?
    mutation UploadUserHandBookFileQuery($productGroupId: String, $filePathKey: String, $file: Upload!, $enrollmentId: String) {
    uploadUserFile(
    productGroupId: $productGroupId
    filePathKey: $filePathKey
    file: $file
    enrollmentId: $enrollmentId
    ) {
    __typename
    url
    fileName
    expiresAt
    }
    }
    I am sharing query, Please help me. Thank you in advance.

  • @KunalGoyal
    @KunalGoyal 6 месяцев назад

    I am not able to download using gradlew command as it is showing me error 'could not resolve classpath' for android gradle plugin and google play services. I tried multipe thing but not working maybe due to version catalogs. I am using gradle version 8.3.1. If anyone got this and solved..please help..thank you

    • @KunalGoyal
      @KunalGoyal 5 месяцев назад

      Worked for me after changing JDK version to 11 or jbr 17 in Settings ->Build, Execution, Deployment -> Build Tools -> Gradle

  • @So7696
    @So7696 10 месяцев назад

    🇩🇿 thanks Philip

  • @ModeratorPolice
    @ModeratorPolice 11 месяцев назад

    how to do Mutation ?

  • @ibrahimal-zaidi6436
    @ibrahimal-zaidi6436 Год назад

    Cool.
    Anyone here know how to use Android Printing Framework With Jetpack compose?

  • @zeeech2560
    @zeeech2560 Год назад

    How to get response code?

  • @alisidhu
    @alisidhu Год назад

    Make api call with retrofit for Soap/xml please in kotlin

    • @ChrisAthanas
      @ChrisAthanas Год назад

      Those are dead protocols at this point. I have never seen a tutorial showing how to use retrofit with XML on android!

    • @alisidhu
      @alisidhu Год назад

      @philipp lackner?

  • @camilohernandezruiz2776
    @camilohernandezruiz2776 Год назад

    9:25 I cannot see the entire command :C

  • @subyk6046
    @subyk6046 Год назад

    Nice content, thanks you very much!
    Can you make video about oauth 2.0, how and where store tokens and how to autologin correctly? :)

  • @gofudgeyourselves9024
    @gofudgeyourselves9024 Год назад +2

    Please do GRPC next

  • @ashok3533
    @ashok3533 8 месяцев назад

    - In plugin 'com.apollographql.apollo3' type 'com.apollographql.apollo3.gradle.internal.ApolloDownloadSchemaTask' property 'schema' doesn't have a configured value. i am getting this error could you please help me

  • @gofudgeyourselves9024
    @gofudgeyourselves9024 Год назад +2

    God's another name is Philipp Lackner

    • @gofudgeyourselves9024
      @gofudgeyourselves9024 Год назад

      @@alexpigeon i just goggled Sam witner as i didn't know who he was and he looks a lot like phillip

  • @camilohernandezruiz2776
    @camilohernandezruiz2776 Год назад

    Excellent, thank you very much for teaching this