Can a native Blackberry application (not MIDlet) use MIDP Push Registry? - blackberry

If I am writing a MIDlet, and if the device supports SMS push registration (i.e. supports WMA 1.1 spec), I will be able to send push messages to the application that is installed on the phone and is listening to SMS messages at the assigned port.
However, if I am writing a Blackberry application, can I still go ahead and use the procedure that applies to MIDP 2.0 devices. If so, can I specify static SMS push registration in JAD file, as we do for a MIDlet?
Would the appropriate JAD property be still specified as MIDlet-Push-1:{}?
Another question, that is not totally unrelated is- are there any bulk SMS providers that allow SMS bearers specify the destination ports that can be integrated with this kind of a solution?
Thanks

A regular blackberry application does not support the push registry. You'll have to keep a DatagramConnection open and listen for the incoming SMS messages that way.
DatagramConnection connection = (DatagramConnection)Connector.open("sms://:1234");
Datagram dgram = connection.newDatagram(connection.getMaximumLength());
connection.receive(dgram); // blocking call so this should be in a separate thread
String message = new String(dgram.getData());
where 1234 is the port you're listening on.
As to you're second question I'm not entirely sure, but I think mblox supports port directed SMS.

For the second question, if the bulk SMS service provider provides you with HTTP API which included the UDH field, you can send messages to application listening in that particular port

Related

Losing messages over lost connection xmpp

i went through this question
Lost messages over XMPP on device disconnected
but there is no answer.
When a connection is lost due to some network issue then the server is not able to recognize it and keeps on sending messages to disconnected receiver which are permanently lost.
I have a workaround in which i ping the client from server and when the client gets disconnected server is able to recognize it after 10 sec and save further messages in queue preventing them from being lost.
my question is can 100% fail save message delivery be achieved by using some other way i know psi and many other xmpp client are doing it.
on ios side i am using xmppframework
One way is to employ the Advanced Message Processing (AMP) on your server; another one is to employ the Message Delivery Receipts on your clients.
The former one requires an AMP-enabled server implementation and the initiating client has to be able to tell the server what kind of delivery status reports it wants (it wants an error to be returned if the delivery is not possible). Note that this is not bullet-proof anyway as there is a window between the moment the target client losts its connectivity with the server and the moment the TCP stack on the server's machine detects this and tells the server about it: during this window, everything sent to the client is considered by the server to be sent okay because there's no concept of message boundaries in the TCP layer and hence if the server process managed to stuff a message stanza's XML into the system buffers of its TCP connection, it considers that stanza to be sent—there's no way for it to know which bits of its stream did not get to the receiver once the TCP stack says the connection is lost.
The latter one is bullet-proof as the clients rely on explicit notifications about message reception. This does increase chattiness though. In return, no server support for this feature is required—it's implemented solely in the clients.
go with XEP-0198 and enjoy...
http://xmpp.org/extensions/xep-0198.html
For a XMPP client I'm working on, the following mechanism is used:
Add Reachability to the project, to detect quickly when the phone is having connectivity problems.
Use a modified version of XEP-0198, adding a confirmation sent by the server. So, the client sends a message, the server confirms with a receipt. Later on, the receiving user will also confirm with a receipt. For each message you send, you get two confirmations, one from the server, one from the client. This requires modifications on the server of course.
When the app is not connected to the XMPP server, messages are queued.
When the app is logged in again to the XMPP server, the app takes all messages which were not confirmed by the server and sends them again.
For this to work, you have to locally store the messages in the app with three possible states: "Not sent", "Confirmed by server", "Confirmed by user"

XCode iDevice app - How to listen for message/request from server?

I have a project where I need to be able to send messages from a server running a web service to a specific iDevice. I have no idea how to do this, so any help is very appreciated.
The scenario: I have a web service which receives some message from an iDevice (could also be a Mac or PC, even an Android device). Depending on the content of this message I need to be able to send a message from the web service to another iDevice (I know the IP-address of the specific iDevice). I know how to use URLRequests to send a message from an iDevice to a server and collect the response from the server. In principle I could every 10 seconds send a request to the server asking if the server has any new messages to the sender (the iDevice sending the request), but I am pretty sure this is not the correct way to do it. Is there a way to have an iDevice listen for server communication on a specific port, so that the iDevice only does something active when it receives a message from the server to do something, e.g. display a message in the app listening for the server communication?
I guess I need to use something similar to the technology used for iMessage, but how is this done?
I am using XCode 4.6.2, iOS 6.1.
EDIT: Just to clarify my needs a bit more: The APNS seems to be TOO unreliable (at least that is what I have read in other threads regarding APN) as the web service in some cases can have the need for sending 2 distinct message to an iDevice within 1 minute (in some cases seconds), and as far as I have read in other threads this will simply not be possible because of how Apple's server handles ASPNS.
The app i am developing only needs to receive messages from the server when the app is active - is there any way, not using APNs, to do this, e.g. making the app listen for communication on a specific port?
Your scenario seems pretty similar to APPLE PUSH NOTIFICATIONs (APNs).
Ideally your server side should write a code in such a way that if there is any change on server side & need to be informed to all associated devices.
Then your server should post notification Apple server which will then send a notification to all the associated devices.
Refer this link
You already have but can use this code to identify the iOS/Mac deivce
NSString *identifierString = [[NSUserDefaults standardUserDefaults] objectForKey:#"myID"];
if (!identifierString) {
CFUUIDRef identifier = CFUUIDCreate(NULL);
identifierString = (NSString*)CFUUIDCreateString(NULL, identifier);
[[NSUserDefaults standardUserDefaults] setObject:identifierString forKey:#"myID"];
}
NSLog(#"%#",identifierString);
this code works till the lifetime of the app only.
After some search I have decided not to use the APNS, because it seems like people are having all sort of experience with it. I cannot use APNS because my project needs 100 % reliability and instant communication with the server.
I have decided to use tcp communication since my project only will be used in a local network. This will obviously mean more power consumption on the iDevices, but reliability is more crucial to the project.

Chat between two iphones

I am looking to create a chat app so that two iphones/mobile can chat with each other.
Can someone please head me in the right direction ?
1. Should I try to connect two devices directly using HTTP or TCP
2. Or should the communication pass through a server i.e. one phone sends the message to the server and server then push the message to other phone ?
If you can tell me any libraries/api that I should use, that would be greatly helpful too.
Or should the communication pass through a server i.e. one phone sends the message to
the server and server then push the message to other phone ?
That's the usual approach. A server with a known address is easy to find; mobile phones that move from one network to another and frequently change their addresses are not. Also, you can keep a server running all the time, so that when one device sends a message, the server receives it and stores it until the other device becomes available. If you were to try to run your chat program on the phones all the time, you'd quickly deplete the batteries.

How to retrieve IP address of JMX Notification message?

I am deploying two Java application with JMX server. The two sending message to JMX Client. However I can't differentiate where the message come from.
How to retrieve IP address of JMX Notification message?
There's no built in way to determine this, but here's a couple of suggestions :
On the notification sender side, add an app id to the notifications user-data or the source so the listener can distinguish between senders.
On the listener side, you could specify the same identifier as the handback object when you register the listener. That way you will know which source the notification came from.

Blackberry Push Implementation and waiting for acknowledgement

I already implemented the first 4 steps of the push initiator for blackberry
Send a push request
BlackBerry service returns a response
BlackBerry service pushes data to an assigned, specific port on device
Device returns response to BlackBerry service
Now I am working on the following two steps but nothing has happened yet:
5. BlackBerry service forwards acknowledgement to content provider
6. Read notification is returned to the BlackBerry service
Does anyone know how to implement that? I provided a domain when filling out the request but how do I achieve connection between me and the blackberry servers and how long do I have to wait for their response?
Actually your content provider send message to blackberry server and also specified the pin number of the device to which content provider want to send the message.
Your device automatically register with bb server if you have bb data service.
Your application is listening in the background on a particular port and your application also has particular app id that is provided by the rim.
So when content provider send message to bb server it also specify the app id and bb server has info about the port corresponding to this app id.and send message to the port of device whose pin is specified by the content provider.

Resources