Huawei Push Kit Notification Message key/value is null in Android - android

I have implemented Huawei Push Kit to my application.
Data messages have been processed by implementing HmsMessageService.
The notification message delivered to the device very well, but when you tap the notification, key/value value that you actually entered is displayed as null. I have set name of theintent filter exactly same with the string on the Console. At the bottom, payload and value are displayed as null even though I filled it from the console. What might be the problem?
In addition, the value was fetched via getIntent from onCreate where the activity started. However, getIntent() is not null.

I believe the phone you are using for receiving the push messages are not meeting with the minimum data message requirements.
Here is a official link about restrictions : Documentation

Related

How to pass data from background android service to react-native

I am building an react-native app. I have a background android service that receives a push notification. I need to store the notification information(title, description...) on a react-native database or in asyncstorage... because in my app I have a page that shows all the notifications. I need that If my app is on background and i receive a notification, when the user open the app the page shows this information. How I can do this?
I try to store the notification on the same database that react-native uses but I can't store the data on the android service. Please, help me.
Did you try exploring these.
componentWillMount() {
Linking.addEventListener("url", this.handleOpenURL);
OneSignal.addEventListener("ids", this.onIds);
OneSignal.addEventListener("received", this.onReceived);
OneSignal.addEventListener("opened", this.onOpened);
}
And in oneReceived event listener you can store data in async storage received from push notification.
onReceived(data) {
this.props.setData(data);
}
In set data you can have your logics to store data.Well i must say push notifications are not used to fetch data and to store and then to render.These provide just little information to open specific screen .Like i received a notification related to deals.Then pressing upon will automatically opens deals screen through linking not the home page of app.For your case you can send the request on that specific page to fetch data.
Yes, but when you close the app and after this, someone sends one push notification, the event received and opened etc don't do nothing. I tried to make a custom native module that receives this info and try to send an Event. I followed this guide:
https://facebook.github.io/react-native/docs/native-modules-android#sending-events-to-javascript
But it don't works, always returns "sendEvent called before bundle loaded" java.lang.NullPointerException.

Foreground app notification is almost empty, background app gets notification but without custom data

I'm working on an Android app in Kotlin and I want to send notification in order to click on it and open a custom view.
I've implemented notification thanks to Firebase. I can send notification thans to Firebase, but the notification are well displayed (with the right icone (= triangle), the right title and the right message) only if the app is in background, but the custom data (key => val) provided in firebase are not detected.
For the foreground app, if I send the notification from Firebase, I can display the custom data (key => val), but the notification doesn't have title, message or custom icone (it has the square/rounded icone)
Instead of showing all my code, I prefere to give you the link I've followed.
https://www.android4dev.com/firebase-pushnotification-android/
I want to have the same result on both side so I can get the custom data.
See the result :
There are two types of FCM messages and the behaviour changes based on it.
Notification messages (these are handled by the SDK automatically)
Data messages (handled by the app)
Use notification messages when you want FCM to handle displaying a
notification on your client app's behalf. Use data messages when you
want to process the messages on your client app.
https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages
I think that you should use data messages instead of notification messages to have a consistent behaviour.

PushNotification "dryRun" attribute for iOS

For Android devices I am using dryRun attribute to control message is delivered to device or not, generally I have used this parameter to check the pntoken is invalid or not without sending a sample message to device.
I am searching for same attributes or a way to check whether token is valid, expired or invalid for IOS devices.
There is no Dry run option for iOS but you might want to go with message without any alert.
{
"aps": {
"category": "categoryName"
}
}
With above payload call will go through but nothing should show up on the device.
Based on this documentation, to run a quick test of your push notification setup for Apple Push Notification Service (APNS), use the Send Test Notification page.
Here are the steps that you need to do.
Enter a connection token string in the Recipient field, OR search for a recipient by clicking Search, and then select one of the search results. By default, the Search results list displays the five devices most recently registered for your connected app.
a. To find other devices, enter a user name in the Search text box.
b. Click Go to generate a list of all devices currently registered under that user name.
Optionally, for Alert, enter an alert message or dictionary per Apple’s specifications.
For Badge, enter a badge number or 0 for no badge.
For Sound, enter the name of a sound file in the application bundle, or enter default to use the system default alert sound.
Optionally, to use a custom payload, enter your payload’s JSON value in the Custom Payload field.
Click Send to send the test push notification, or click Clear to reset the form.
For more information, check this SO question and this thread if it can help you.

What exactly is scAddress in SmsManager's sendTextMessage function?

I'm working on an application that will be sending a text message to another person from the app (this is not being published to the Play Store). I am looking at the documentation for SmsManager, and there is a parameter (which I currently have null), scAddress, which is described by:
String: is the service center address or null to use the current default SMSC
In short, I don't want the app to use my actual phone number to send out this text message. What exactly is the "service center address?"
My application does not care about receiving a response for the text message. What happens if the user replies to this message? Is this related to the service center address?
Thank you!

Why does a ParseUser have been registered without a deviceToken?

I've experienced a strange thing in my Parse app: a new Installation record has been added, from an Android device, but its deviceToken field is blank. Probably for this, the new user doesn't receive any push notification (subscribers targeting his device are always zero).
Why this situation?
You may also use installation table just to track installation of app across user devices, for example to handle loading data from other device ...

Categories

Resources