Hey guys i am an android developer and have followed the tutorials on instant messaging using sinch and parse from https://www.sinch.com/tutorials/android-messaging-tutorial-using-sinch-and-parse/.
It works quite good but i am trying to customize it a little such that i can send a message based on the recipients's id and another id . That is i want to send a message taking into consideration two ids( recipientId and another id which i defined).
Please i would appreciate any work arounds this.
Create a WritableMessage(List recipientUserIds, String textBody)
Constructs a message with a list of recipients and a text body.
http://download.sinch.com/docs/android/latest/reference/index.html
Related
Short description: I get push notification from twilio chat. But in my app I use 4 different chats (channels). So when I get field "bage" from notification it just show count of chats with new messages, but not amount of messages.
How can I get the sum of unread messages from all chats?
More info:
I use react-native 0.61.2 but I write native code too;
During the work I have used this tutorial TwilioChatReactNative;
For indicate unreaded messages I use Message Consumption Horizon;
The way of connection to chat (only react part) the close to this Connect to chat;
In theory I can get set bage himself, but for me this function don't work in background;
PushNotificationIOS.setApplicationIconBadgeNumber
Also I have tried to use this library react-native-notification but it didn't help too.
I subscribe to pushNotification with this method
client.setPushRegistrationId('apn', token);
When I use twilio notify and set "bage" by hand all work good, but notification from chat twilio do by himself.
Summary: I need one decision from this list (or something else, I open for offers):
Say twilio send me sum of unread messages from all chats;
Way how update "bage" from background;
New way of subscribing to channels to get the sum of messages in "bage".
Thanks to everyone who will respond
Thank you for your questions and for using Twilio Programmable Chat! I have opened this issue in the repo found at https://github.com/twilio/TwilioChatJsReactNative/issues/40 so that folks using the repo can see the answers there. :-)
I'm working with one live chatting application via XMPP, Used aSmack as client and configured ejabberd for server end. I'm Implement one to one chat and it's working fantastic. Now I'm trying to integrate Broadcast message to Multiple user.
I'm learn XEP-0033 protocol because I know this protocol is responsible for message broadcasting and also getting full theoretically clarity on same Basically my question is
I'm not getting any proper reference for integrate this protocol in my code.
Is aSmack is provide a predefined stanza for this protocol or May I need to make custom stanza to integrating this protocol. If yes than please suggest any reference link for same.
I'm also check MultiUserChatLightManager but this class is for Group chat but I need to first integrate Message broadcasting.
Is any change is required at ejabberd server side for implementing this protocol?
I'm not too much expert on XMPP.
i had the similar problem and was solved using this
upload a broadcast plugin to your openfire server.link is here
and the read me link for the plugin here
for broadcasting the message follow the pattern to set To Id
all#[serviceName].[serverName]
where serviceName is broadcast and serverName is our server name
send your xmpp message from your android client like this
Message msg = new Message();
msg.setBody(yourmessage);
msg.setFrom(yourJid);
msg.setTo("all#broadcast.yourservername");
yourXmppConnection.sendStanza(msg)
for other alternative and high customization in broadcasting message you can go for XEP-0060: Publish-Subscribe here
and here is the smack e.g
I am trying to automated a flow where I can read sms and then parse the SMS to read the OTP and enter it in another webapp. Looked through all forums but couldn't find an answer.
I am writing code in java and trying to run a webapp on android device using appium.
Can someone suggest how to do it?
If you want to read sms from device in Appium session there is a good approach described in discuss.appium.io
I think you can create several sessions in one test: 1 - to get sms with native app, 2 - open webApp in mobile browser and do whatever you need
This approach worked for me
Suppose your OTP sms is like "OTP is 12345 for your order", and it shows up in your notification panel,
Reach the OTP Screen
Pull down the notification bar ((AndroidDriver) driver).openNotifications();
Wait for this element otpElement with xpath //android.widget.TextView[contains(#text,'OTP is')] is displayed (ie, While the sms arrives)
Use OTPmessage = otpElement.getText() to get the OTP message text
Extract OTP using this code : String OTP = StringUtils.substringBetween(OTPmessage, "OTP is ", " for ");
Close notification panel using ((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.BACK));
I dont think this is a good approach if you are testing the app. It might take lot of time for the OTP to arrive thereby failing your test unnecessarily. Better ask your devs keep the OTP fixed so you don't need to receive it through the sms everytime.
You can add a key to store last OTP in an in-memory storage like Redis or closured Dictionary in your backend language, you will then update this key with the value of the OTP you want to send out via an SMS service provider. The last sent OTP stored in this key should then be exposed via an additional api endpoint in your service, which you would then call as part of your automated script after doing an action that will make the OTP to be sent.
A more reliable and robust modification of this will be to expose an API that retrieves the OTP stored against each phone number, you must have this stored already of course before you could do the verification in-app. This endpoint must only be exposed within a test environment, that's the precaution to pay attention to, or you make the endpoint available only to authorized user roles.
I am trying GCM based android app to push messages from server to android client. I am able to push fix string with the following coe. I am wondering about the ways to push XML file from server and parse at the android application. I have done some research but I couldn't find push XML rather I found send XML file. Thank you
if (androidArray.size() == 1) {
String registrationId = androidArray.get(0);
Message message = new Message.Builder()
.collapseKey(collapseKey)
.timeToLive(30)
.delayWhileIdle(true)
.addData("message", Message)
.build();
Result result = sender.send(message, registrationId, 5);
You don't push xml (or JSON preferably) to the android app. You send a simple message to the app.
when the app receives the message it then needs to go and pull the xml/json from the website with an http get request to the relevant url that will supply the xml.
The android app can then parse the response and do whatever you want it to.
Here is an EXCELLENT tutorial on C2DM (The forerunner to GCM) http://www.vogella.com/articles/AndroidCloudToDeviceMessaging/article.html
You should be able to work out the differences needed.
UPDATE
Google Android has a complete section on GCM which can be found here
http://developer.android.com/google/gcm/index.html
Within that link there are getting started guides and a GCM Demo app
There are limits to the amount of data you can send and you should not rely on your data not ever exceeding the limits or Google arbitrarily changing the amount of data you are allowed to send.
Should either of those occur you would need to update your app so just do it right in the first place.
The message you send should act as a "key" to determine what action to take when the message is received.
UPDATE
If you are feeling REALLY adventurous you could use a custom sync adapter to help you consume your web services. It's pretty advanced stuff but if you are feeling curious about this then watch the Google I/O seminar on consuming RESTfull web services http://www.youtube.com/watch?v=xHXn3Kg2IQE
I have seen many times the ease of sending an email in the foreground using the Android Intent Action.SEND.
However I need to implement a feedback form which emails us the details on completion. This doesnt really suit the Android Intent because the user wouldnt want to see the generated email before sending.
Does anyone have any sample code which can send an email form the background if we assume the smtp server is lol.does.thiswork and the username = lala, password = po.
Cheers
Possible duplicate of this: Sending Email in Android using JavaMail API without using the default/built-in app and plenty of example code in there.
as an editorial note, anytime an application I am using on a phone sends an email, I personally WOULD want it in the foreground. If its just feedback from a form on your application, you could also use several solutions other than email: a web form in a webview, or create a socket back to a server you host, or a use a webservice etc...