how to get the short codes from a service providers?
I want to create a app that could receve these sms sent to the short codes by the user and the app should return the response to the client.
You need a suitable sms gateway. Like this two german sites:
smstrade.de
smskaufen.com
Related
What I really need to accomplish is an instant messaging feature using Firebase.
I've been reading the Firebase Cloud Messaging docs, but I get very confused about the pourposes of the example codes on the server side.
I thought about this solution:
Send a message on the client app to Firebase via RemoteMessage.send()
On Firebase, I catch that message and "redirect" it to the message reciever, who is another client of the app.
In my client app I have this code that I took from the documentation (Firebase was previously initialized):
instance.send(new RemoteMessage.Builder(senderID + "#fcm.googleapis.com")
.setMessageId(Integer.toString(messageID))
.addData("message", message)
.addData("action", "SAY_HELLO")
.build());
That would be the first part of the solution, but now I'm stuck on the part of the code where Firebase should "catch" the message and sends it to another user.
I was trying to write a node.js function to accomplish this, but the problem is that I don't know what is triggered when Firebase gets a RemoteMessage.
Would you mind explaining me how can I do this?
Any code example will be welcome. Thanks :)
I already have an app and I want to start sending notification to the users. I already set up everything in the app(using react native) and I checked manually that I can send notification to the devices and it works.
Now I want to run a job in the server who will push the message (with the device token) to the cloud messaging in firebase.
I can't find a lot of details about how to do it. I would like if someone can give me any guide I can use with. my server is in Kotlin(java can be good too) and I m working with gradle.
Thank you so much for the help
From a Java server you can use the Firebase Admin SDK to send messages. From that documentation comes this minimal example:
// This registration token comes from the client FCM SDKs.
String registrationToken = "YOUR_REGISTRATION_TOKEN";
// See documentation on defining a message payload.
Message message = Message.builder()
.putData("score", "850")
.putData("time", "2:45")
.setToken(registrationToken)
.build();
// Send a message to the device corresponding to the provided
// registration token.
String response = FirebaseMessaging.getInstance().send(message);
// Response is a message ID string.
System.out.println("Successfully sent message: " + response);
Note that this sends a data message, so that will always be delivered to your code, where you can decide to display a notification or not. To send a notification message, which is what the Firebase console does, you'd use:
Message message = Message.builder()
.setNotification(new Notification("This is the title", "This is the body"))
.setToken(registrationToken)
.build();
Both of these send the message to a specific registration token, so only to a single device/app instance. This means you will need to maintain a list of these tokens, in a way that allows you to send the messages to fit your needs. E.g. a common way is to store the tokens per user. For an example of that, see the functions-samples repo. While this example is in Node.js, the same logic could be applied to a Java server.
Finally: you can also send message to topics. For an example of that (again: using a Node.js server), have a look at this blog post Sending notifications between Android devices with Firebase Database and Cloud Messaging.
I been trying to understand how bacnet java works on device reply “iam” message to the respective call
For example:
1. Device 5678 send broadcast message with new whois message(device id 1234)
2. Device 1234 replies “iam” message to device 5678.
Questions
How device 1234 send “iam” message to 5678?
Which part of JAVA code does that??
I'm happy for any input on the subject.
Best regards
Sorc
who-is and i-am are both unconfirmed BACnet services.
when a who-is is sent (broadcast or unicast) by a device, other devices present in network reply with i-am.
assuming that you are using java based BACnet stack (library) to create your own application. your application will receive i-am, that received from network in the form of callback from stack library.
in general the stack (implemented in any programming language) will decode this data and pass it to application in the form of callbacks.
hope this helps you.
On the basis that the Who-Is broadcast contains the SADR/source address, the receiving devices knows where to send it's response - if it did want to give a unicast/directed response.
You then have to listen out for the UDP (- UDP/IP -) response, and then you have to parse it, for the Object ID.
I am really rookie and need an advice.
I have read documentation, and as far as i understood if you need send direct message, follow next steps:
Make authentification, eventually you get Firebase TokenId and
userId
Send them to your server side and store it in DB
When you are going to send a message you need create json and put
inside topic text and resipent userId so on...
Send this json via HTTP to your server side
When server retrive this json, it should use Firebase API to
create new message bloc child with random name in firebase
Eventually server have to find recipent user in DB by userId that we get from message.
After server will find current recipent user by userId , next we should take firebase tokenId In order to sent notification .
And send recipent user notification with such data - name of new
message bloc child
Recipent will connect to this current bloc and retrive data
It is as i understood this consept, fix me please if smth wrong?
Your suggested approach sounds good. The most important thing to realize is that you require an app server to send a downstream message to a device. Using the database as the communication mechanism between the app and the app server is a popular approach.
You could also use Cloud Messaging's upstream capabilities. But I've never tried that approach, because the database works fine for me and I had little interest in learning yet another protocol (XMPP).
You can read how I implemented it in this Firebase blog post Sending notifications between Android devices with Firebase Database and Cloud Messaging.
I use opensmpp library for sending sms, but I cannot find documentation or example of sending long messages. I want to send long messages by splitting and using UDH (because it's sms gate requirement). Where can I find documentation or example for Opensmpp java library?
Good to hear it worked! As a short summary, this would be the way to add additional header information for multipart/concatenated SMS delivery using OpenSmpp:
SubmitSM smRequest = new SubmitSM();
smRequest.setEsmClass((byte)Data.SM_UDH_GSM);
The above code was taken from this article about multi-part SMS that includes sample code and extended technical details.