Git Product home page Git Product logo

Comments (3)

jeromegamez avatar jeromegamez commented on July 22, 2024

I edited your code block for better readabilty.

I am quite confident that the package and its underlying library works. If you don't get an error it means that the Firebase API has received and accepted your message. Now, there are two possibilities where the issue lies:

  1. Firebase has accepted the message but didn't deliver it. In that case, there's nothing we can do from our side of the interaction. If you're convinced that everything is correct code-wise, you should open a support ticket with Google (but only after checking (2) 😅)

  2. The device that you expect to get notified is not subscribed to the topic you're sending the notification to.

To check (2), you'll need the registration token of the device that you're testing with. For example, if you're using the Firebase Web Client, you can do this with firebase.messaging.getToken().

Once you have the token, you can get the topics it's subscribed to by inspecting the App instance as described at https://firebase-php.readthedocs.io/en/5.8.1/cloud-messaging.html#working-with-topic-subscriptions

$messaging = app('firebase.messaging');

$appInstance = $messaging->getAppInstance('<registration token>');

/** @var \Kreait\Firebase\Messaging\TopicSubscriptions $subscriptions */
$subscriptions = $appInstance->topicSubscriptions();

foreach ($subscriptions as $subscription) {
    echo "{$subscription->registrationToken()} is subscribed to {$subscription->topic()}\n";
}

If the topic appears in that list, the device/registration token is subscribed to the topic, and you should proceed with (1).

If the topic doesn't appear in the list, your device is not subscribed to the topic and cannot receive a message sent to that topic. In this case: subscribe the device to the topic 😅

from laravel-firebase.

wontone18 avatar wontone18 commented on July 22, 2024

Thanks, i will first fix this from my react native client. I have tested this with a another alternative code in that it works smoothly. Yes token id was missing in the above.

from laravel-firebase.

jeromegamez avatar jeromegamez commented on July 22, 2024

I'm closing this now because this is most likely nothing that can be fixed from the side of the Laravel package or SDK, but feel free to add further comments or share your findings. 🤞

from laravel-firebase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.