How to Build a Home Screen Widget in Jetpack Compose with Glance

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 พ.ค. 2023
  • In this video we'll build a home screen widget in Jetpack Compose with the new Jetpack Glance library.
    ⭐ Get certificates for your future job
    ⭐ Save countless hours of time
    ⭐ 100% money back guarantee for 30 days
    ⭐ Become a professional Android developer now:
    pl-coding.com/premium-courses...
    Get my FREE PDF about 20 things you should never do in Jetpack Compose:
    pl-coding.com/jetpack-compose...
    💻 Let me be your mentor and become an industry-ready Android developer in 10 weeks:
    pl-coding.com/drop-table-ment...
    Subscribe to my FREE newsletter for regular Android, Kotlin & Architecture advice!
    pl-coding.com/newsletter
    Join this channel to get access to perks:
    / @philipplackner
    Get the source code for this video here:
    github.com/philipplackner/Wid...
    Join my Discord server:
    / discord
    Regular programming advice on my Instagram page: / _philipplackner_
    Checkout my GitHub: github.com/philipplackner
    You like my free content? Here you can buy me a coffee:
    www.buymeacoffee.com/philippl...

ความคิดเห็น • 45

  • @drhell6661
    @drhell6661 ปีที่แล้ว +17

    Nice tutorial 👍. Just FYI, Glance is in beta right now and can no longer override Content function. U should override ProvideGlance function and then provideContent inside. Was testing this out at work last week...

  • @tuhinbhowmick8424
    @tuhinbhowmick8424 ปีที่แล้ว +1

    philipp you literally read my mind , just a week ago I was discussing with my friends about trying out widgets , and here you are with a video

  • @jatinsingalEARCS
    @jatinsingalEARCS ปีที่แล้ว +2

    I was waiting for this for so long ❤ thanks

  • @wagnerarcieri
    @wagnerarcieri ปีที่แล้ว +2

    I really liked to see the errors coming out and the fixing!

  • @argahutama
    @argahutama ปีที่แล้ว

    It's very helpful. Thank you.

  • @Amir.Mousavi
    @Amir.Mousavi ปีที่แล้ว

    You are amazing bro , thanks

  • @st4849
    @st4849 ปีที่แล้ว +20

    This is still pretty convoluted. I hope Google will update Android to interface directly with Compose so that legacy Activity/Theme/Widget APIs won't impose any limitations anymore.

    • @arjun1194
      @arjun1194 9 หลายเดือนก่อน

      its not a limitation and XML will never be completely removed from android. Just learn it bro

  • @misterex99
    @misterex99 6 หลายเดือนก่อน +2

    Hi sir, how make widget clock and update every minute with receive TIME_TIC? Thanks you for your video.

  • @appaznay
    @appaznay ปีที่แล้ว

    great tuto, I love it thank's

  • @josema2702
    @josema2702 ปีที่แล้ว

    this is crazy, I have been for days searching for a good glance tutorial, and now you do it, you have cameras in my house?

  • @azamovdev
    @azamovdev ปีที่แล้ว +1

    amazing fantastic

  • @starry_shivam
    @starry_shivam ปีที่แล้ว +8

    I've tried glance, but it's very buggy and limited which makes it mostly useless for anything other than sample apps, i had to switch to XML and widget manager API between development since what i wanted to do was impossible with glance and results were getting unpredictable.

    • @PhilippLackner
      @PhilippLackner  ปีที่แล้ว +5

      That's why it's in alpha

    • @starry_shivam
      @starry_shivam ปีที่แล้ว +1

      @@PhilippLackner yep! but still a great idea nonetheless, probably will take a year or so before it can be actually useful imo

  • @mrwaseemmalik5766
    @mrwaseemmalik5766 11 หลายเดือนก่อน

    It worked just little version update well thanks

  • @rajaarumugam2018
    @rajaarumugam2018 11 หลายเดือนก่อน +1

    Nice tutorial.👍
    I have one doubt. how can we make API in android widget?

  • @daimonkor
    @daimonkor ปีที่แล้ว

    Is there variant setLocale to glance widget? Like that ' resources.updateConfiguration(configuration, resources.displayMetrics)'

  • @taar1
    @taar1 ปีที่แล้ว

    I'm using 1.0.0-beta01 and setting a custom color to the Text doesnt seem to work. How can I achieve this? Using "color = ColorProvider(Color(R.color.widget_background))" doesn't actually result in the color I'm expecting.

  • @EmanNollase
    @EmanNollase ปีที่แล้ว

    nice tutorial, anyway, how can we update the widget from the main app?

  • @germenwong
    @germenwong ปีที่แล้ว

    Hi, this is a very good course, but I am currently encountering a problem at work. Glance has moved from the alpha version to the beta version, and the API has been changed. Can you provide another course on Glance and provide an example of how to obtain the API to display on the widget? I really need it and hope to receive your reply. Thank you

  • @blackmartini7684
    @blackmartini7684 ปีที่แล้ว

    Can you make a simple line chart with labels 🥺 been struggling with this

  • @Sj-yf2jg
    @Sj-yf2jg 11 หลายเดือนก่อน

    Please make a video on How to implement AdMob banner & interstitial ads in jetpack compose apps

  • @j2shoes288
    @j2shoes288 ปีที่แล้ว

    I thought there was a video regarding whether KMM is worth it or not?

  • @mahmoudalkateb2008
    @mahmoudalkateb2008 ปีที่แล้ว

    🎉🚀

  • @a2ke5e1
    @a2ke5e1 9 หลายเดือนก่อน

    Is it possible to make Glance widget automically every few seconds?

  • @hesten
    @hesten 10 หลายเดือนก่อน

    Created a flutter app and developed the iOS widget for 7 days. Started on the widget for android and still have not got half of features in 7 days. All other tools from Google regarding Glance are outdated, even the examples, so this is like a fluid you try to contain which constant refills. You could be really ahead creating more advance glance widget with external loading api, statehandling and a config screen.

  • @dclasses662
    @dclasses662 ปีที่แล้ว

    Please sir make videos jetpack compose with sqlite databases..

  • @tippufisalsheriff1071
    @tippufisalsheriff1071 ปีที่แล้ว

    How to show toast while clicking on widget

  • @PSK005
    @PSK005 ปีที่แล้ว

    Can you make video onboarding without accompanist?? 😊

  • @crayolaksh
    @crayolaksh ปีที่แล้ว

    It moved to beta recently!

  • @elyornasrullayev1630
    @elyornasrullayev1630 ปีที่แล้ว

    how much your courses bro?

  • @silver10188
    @silver10188 ปีที่แล้ว

    I can't override Content composable why??? I can only find provideGlance which is not a composable, What to do? Their docs all show override Content() composable, but the Android Studio can only overrides privideGlance(). Typical Android development right there. Any help appreciated.

    • @silver10188
      @silver10188 ปีที่แล้ว +2

      Thanks to @drhell6661 we should override provideGlance(), then inside it implement provideContet{}, which accepts composables.

  • @AnDiHawk
    @AnDiHawk ปีที่แล้ว

    I don't really understand why such lessons with such trivial tasks. :) Creating really serious and high-quality widgets with serious functions, with downloading the right data automatically on a schedule, is often more difficult than creating a separate application that performs the same functions inside itself. Especially since the developer is very limited by the tools that Google has provided for creating widgets, as opposed to working with fragments and activities. In addition, there is very little information that really fully covers the nuances of creating and working widgets. And to really solve this issue, it will take a whole course of lessons.

    • @PhilippLackner
      @PhilippLackner  ปีที่แล้ว

      Simply because beginners are overwhelmed with such things and they're the biggest portion of viewers 🤷🏼‍♂️

    • @AnDiHawk
      @AnDiHawk ปีที่แล้ว +1

      @@PhilippLackner I understand your position. And globally, I really appreciate your channel. You give very useful information. But in this case it seemed to me that such a short, superficial lesson can greatly mislead beginners, because the creation of high-quality, multifunctional widgets is often more difficult than an independent application with the same functions. :) Quite often, and sometimes for a long time, you have to find and invent solutions when creating widgets to get around the rather severe restrictions from Google. While the same tasks in fragments and activities are often implemented with a few lines of code. :)

    • @PhilippLackner
      @PhilippLackner  ปีที่แล้ว +1

      @@AnDiHawk but how big is the portion of devs who have to build these really complex widgets 😅 from my channel, maybe 0,5% will ever need to do that and especially if I make a longer course about it, the views radically drop towards the end. In a perfect world I could cover every topic with all their details, but that's not maintainable and also won't bring food on my table (which I also have to make sure with the videos I choose)

    • @AnDiHawk
      @AnDiHawk ปีที่แล้ว +1

      @@PhilippLackner I understand your arguments. :) Just responded to the topic of widgets, as I myself had to go through their development from scratch. With my excessive perfectionism it turned out to be quite a challenge for my task. :) I'd be happy if I could find enough quality information about widget development. But there really isn't much. It is a pity that Google was much earlier in introducing widgets, unlike Apple, but still the question of how to create high-quality and functional widgets for Android is severely underestimated. While for iOS they are very popular and bring good money to developers, despite much less interactivity.

    • @nijuyonkadesu
      @nijuyonkadesu ปีที่แล้ว

      I wonder what Chinese android community have in their pocket about widget development... of many ppl I've seen in telegram, chinese people are so great at android app development...

  • @immortal_lnight
    @immortal_lnight ปีที่แล้ว +1

    First

  • @jcddcjjcdnz
    @jcddcjjcdnz ปีที่แล้ว +1

    Sadly the more Compose evolves the less I like it.

  • @noemibalazs9431
    @noemibalazs9431 2 หลายเดือนก่อน

    Nice tutorial!
    Can anyone help me out why the parameters passed to the activity are always nulls?
    Box(
    modifier = GlanceModifier.fillMaxSize()
    .clickable(actionStartActivity(parameters = actionParametersOf(widgetIdKey to 12)))
    )
    implementation "androidx.glance:glance-appwidget:1.0.0"

  • @gofudgeyourselves9024
    @gofudgeyourselves9024 ปีที่แล้ว +6

    Lol the api has changed already 🤣. Typical android development