Comments (7)
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.
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.
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.
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.
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.
@tribitinfotech ,
Did you have a chance to try my suggestions?
from pushnotification.
Since I haven't got any reply I assume it was solved...Closing the thread.
from pushnotification.
Related Issues (20)
- Unable to send notifications via FCM.
- Content-Type:" is not valid header name HOT 6
- Document breaking change in v4.5.1?
- [L 6.0]Testing push notification
- Breaking change in 4.5.1: Undefined index: headers HOT 2
- loc-key and loc-args on the payload
- Undefined index: headers HOT 7
- Need support of Voip
- Badge count not working with fcm
- Push notiication not working on Ios
- update to newer versions
- notifications not sendings HOT 2
- Installation issue with laravle9.2 HOT 4
- Issue in Laravel 9.2 HOT 7
- FCM Api Key HOT 2
- add support for huawei
- cannot send push notifications(ios, android)
- Error al crear $push = new PushNotification
- MissingTopic HOT 1
- Migrating from legacy FCM to HTTP v1 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pushnotification.