Giter Site home page Giter Site logo

Comments (7)

Edujugon avatar Edujugon commented on August 14, 2024

Hi @tribitinfotech ,
When send a push notification the package sends a post request to the provider, in your case FCM. That post content is json type always.
Then the provider is the one what send the notification to the client/s (devices). So how the data gets the devices is out of the package's scope.

Please recheck how you are parsing the data from your android side.

What is the backend response after sending the notification?
Use getFeedback() method after sending notification in order to get the provider response.

from pushnotification.

tribitinfotech avatar tribitinfotech commented on August 14, 2024

Hi @Edujugon
Andtoid side I am using parsing

try {
JSONObject json = new JSONObject(remoteMessage.getData().toString());

String title = json.getString("title");
String message = json.getString("body");
String Url = json.getString("imag_uri");

} catch (Exception e) {
Log.e(TAG, "Exception: " + e.getMessage());
}

I am getting exception on first line because As I can see in response. there is "" missing in key and value in pushnotification response. I had implemented push notification in android many times and used php server for send push. every time got proper json response. but this time I am using your pushnotification code and not getting valid json push notification response.

from pushnotification.

Edujugon avatar Edujugon commented on August 14, 2024

@tribitinfotech ,

Could you please paste here an example of data you are sending from backend and also the data you are getting in client side?
Also, paste here the pushNotification response (getFeedback()).

from pushnotification.

Edujugon avatar Edujugon commented on August 14, 2024

@tribitinfotech ,

Also give a try to the below code:

Map<String, String> params = remoteMessage.getData();
                JSONObject object = new JSONObject(params);
                Log.e("JSON_OBJECT", object.toString());

from pushnotification.

Edujugon avatar Edujugon commented on August 14, 2024

@tribitinfotech ,

From backend you should do something like follows:

$push->setMessage([
    'data' => [
        'imag_uri' => 'https://static.pexels.com/photos/4825/red-love-romantic-flowers.jpg',
        'body'=> 'Shy7lo Offer',
        'title' => 'Shy7lo Offer'
   ]
])->setDevicesToken(HERE-YOUR-TOKENS)
  ->send()
  ->getFeedback();

from pushnotification.

Edujugon avatar Edujugon commented on August 14, 2024

@tribitinfotech ,
Did you have a chance to try my suggestions?

from pushnotification.

Edujugon avatar Edujugon commented on August 14, 2024

Since I haven't got any reply I assume it was solved...Closing the thread.

from pushnotification.

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.