Firebase Push Notifications with HTTP V1 API in Flutter | REST API Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 เม.ย. 2024
  • This tutorial teaches how to implement Firebase push notifications in a Flutter app using the HTTP V1 API and REST API. We'll cover generating an access token using a service account JSON file, creating HTTP requests for push notifications, and handling message parsing. Additionally, you'll discover how to send custom data with notifications and handle incoming messages in the app.
    Don't forget to like, subscribe, and hit the bell icon for more Flutter development tutorials!
    import 'package:googleapis/servicecontrol/v1.dart' as servicecontrol;
    packages:
    http: ^1.2.1
    googleapis: ^13.1.0
    googleapis_auth: ^1.5.1
    link:
    firebase.google.com/docs/clou...
    github.com/CodeMender1204/Flu...
    #Flutter #Firebase #PushNotifications #RESTAPI #MobileAppDevelopment #FirebaseCloudMessaging #FlutterTutorial #OAuthtoken #http #HTTPV1Api #firebasetutorial

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

  • @kyungsooswifeu8240
    @kyungsooswifeu8240 8 วันที่ผ่านมา

    You're such a savior thank youuuu

  • @samelobinna101
    @samelobinna101 7 วันที่ผ่านมา

    thanks a lot you save my day (:

  • @radish121
    @radish121 19 วันที่ผ่านมา

    dude, seriously, thank you so soo soooo much, can't figure this out for a couple of days now and almost gave up. literally a life saver

    • @CodeMender
      @CodeMender  19 วันที่ผ่านมา

      Glad I could help!

  • @Alabfa
    @Alabfa 14 วันที่ผ่านมา

    You are a life saver thank you so much

  • @user-vd6xi9bf3m
    @user-vd6xi9bf3m 23 วันที่ผ่านมา

    Hey, Thank you soooo much, you saved my day:)

    • @CodeMender
      @CodeMender  19 วันที่ผ่านมา

      You are welcome!

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

    thanks sir

  • @computerscience3905
    @computerscience3905 3 วันที่ผ่านมา +1

    i am getting this error
    Unhandled Exception: Failed to obtain access credentials. Error: invalid_grant Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values in the JWT claim. Status code: 400

    • @CodeMender
      @CodeMender  2 วันที่ผ่านมา

      Check the grant values you are adding if you are not adding anything add exp anf iat for your token in the function for generation token

  • @amirhaider-gc9ww
    @amirhaider-gc9ww 8 วันที่ผ่านมา

    Failed to send FCM message: 404

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

    make a second part of it,, also use laravel backend to send etc

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

      Will work on it soon.

  • @MuhammadAhmedLashari-px8qh
    @MuhammadAhmedLashari-px8qh 3 วันที่ผ่านมา

    i am getting the above two statements on terminal successfully but aren't receiving the notification on device screen. Can you please help me in that?
    I/flutter (29003): FCM message sent successfully
    D/FLTFireMsgReceiver(29003): broadcast received for message

    • @CodeMender
      @CodeMender  2 วันที่ผ่านมา +1

      The firebase push notification is only shown for background notification for foreground notification you need to customize toast or alert.

  • @Marketplace-fm8mg
    @Marketplace-fm8mg 2 หลายเดือนก่อน

    where to get client_id and client_secret by using post man

    • @CodeMender
      @CodeMender  2 หลายเดือนก่อน +1

      To obtain the client_id and client_secret:
      Navigate to the Google Cloud Console, access the service account section, and generate a key. The JSON file will contain the necessary client_id and client_secret.
      To get the bearer token in Postman follow these steps:
      1. Utilize Google OAuth Playground to authorize API access by Entering your OAuth client ID and client secret (obtained from Google Cloud Console).
      2. Specify your desired scopes for Firebase Cloud Messaging (FCM) by accessing this URL: www.googleapis.com/auth/firebase.messaging
      3. Click on "Authorize APIs" and go through the authorization process.
      Exchange the authorization code for tokens.
      The access token serves as your Bearer token.

  • @hashWorld-0
    @hashWorld-0 หลายเดือนก่อน

    plz do this in dio
    dio interceptors whats the difference?

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

    Why there is no video of sign in with apple in you channel
    you don't know how to do?

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

      th-cam.com/video/IQdnE0qIxNk/w-d-xo.htmlsi=k-kFfjVGB79_h-R_

  • @NostalgiaBeats-zo4ds
    @NostalgiaBeats-zo4ds หลายเดือนก่อน +1

    please give me a source code

    • @CodeMender
      @CodeMender  25 วันที่ผ่านมา

      Added in the description

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

    You have not provided any link or ref of the code you copy pested. Sad!

    • @CodeMender
      @CodeMender  25 วันที่ผ่านมา

      Check the description

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

    Not so explanatory 😢😢

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

      I'm sorry to hear that! If you provide more context or clarify what you'd like to know about video comments, I'd be happy to help. 😊

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

      @@CodeMender how can I generate access token please, I already have my service key and json file

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

      Create Scopes for which you want to allow the authorization when using the access token. Create a client using your JSON file by HTTP package and use the googleapis package to get credentials by sending client, scopes and ServiceAccountCredentials from the json file. You will get accessToken in the credentials.

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

      @@CodeMender thanks