Detect whether email is sent or not + Blackberry - blackberry

I am facing a little problem with Transport.send(msg) function of Blackberry API. In my application i need to send a sound file. But I want to know what happens if the device loses connectivity in middle of sending the email.
I tried to enclose the Transport.send(msg) call within try catch block but it never throws exception even if i manually turn off the wifi from the device while the file is being sent.If by any chance email could not be sent i want to show the user a Dialog saying that email could not be sent.
Kindly help.
Regards,
tek3

You can catch SendFailedException which is thrown when a message cannot be sent.
You can monitor the messages by calling getStatus() on a message which should return you the values given here

Related

Accessing previous MSMessages from MSConversation

If I have sent a few messages in my iMessage app and I want to access previous messages (obviously just my own app-created messages, not just any messages the users have sent in their conversation), is there a way I can do that?
I can access the most previous message with this:
[self activeConversation].selectedMessage;
Any way to loop through previous messages that might not have even ever been clicked by the user (so simply storing it in user defaults is not an option)
There is no way to do this. Apple considers this to be a security/privacy issue.

Twilio iOS Video Call: Getting "User is unavailable" error message when user rejects the call

I am implementing twilio's video call in my iOS application. The problem is that I am looking for a way to know when the counterpart application is dead to send him a VoIP Push notification.
The solution I was trying to implement was that, when the call returns "User is unavailable" error then i would tell my backend to send VoIP notification to the counterpart, the problem with this solution is that I found a twilio's bug where sometimes if the user rejects the call twilio's SDK returns a wrong error message saying "User is unavailable" instead an error with "User rejects the call" message. So I can't know if the user was really unavailable (to send the VoiP notification) or if the user just rejected the call
How to reproduce the error?
1. Connect two clients with fixed identity id. For example "identity1" and "identity2"
2. Make a call from "identity1" to "identity2" and rejects it from "identity2". You will receive the correct error message "User rejects the call"
3. Close the app in "identity2" WITHOUT CALLING UNLISTEN, just kill the app.
4. Then start the app again in "identity2" (change the token if you want but let the same identity id).
5. Make a call from "identity1" to "identity2" and rejects it from "identity2". You will receive the wrong error message "User is unavailable" instead "User rejects the call".
Thats the problem is like twilio would not remove the old client's instance if we don't call unlisten. And if I can't difference when user is unavailable or when just rejects the call then I can't send the VoIP push when is really needed.
In order to receive incoming call, you have to call listen API on each launch of the app. It seems you might be killing the app after listen but after relaunch listen was not called on client. So when the remote party makes an outbound call, it is getting TWCErrorCodeConversationParticipantNotAvailable.
Once conversation client starts listening for incoming calls, remote party should receive TWCErrorCodeConversationRejected on reject.
In other words, if A calls B, and B is not listening (i.e. not called listen on client), A will receive “user is unavailable".
The example in Swift:
/* Create an AccessManager - this provides a single place to update your Twilio
Access Token when using multiple Twilio SDKs */
var accessManager = TwilioAccessManager(token:self.accessToken, delegate:self)
// Create a Conversations Client and listen for IncomingInvites
var client = TwilioConversationsClient(accessManager: accessManager, delegate: self)
client!.listen()
// MARK: TwilioConversationsClientDelegate
// Selectively handle IncomingInvites based on the originator
func conversationsClient(conversationsClient: TwilioConversationsClient,
didReceiveInvite invite: TWCIncomingInvite) {
if (invite.from == "ringo") {
invite.reject()
} else {
/* See the "Specify Local Media Constraints when Creating a
Conversation" guide for instructions on constructing LocalMedia */
invite.acceptWithLocalMedia(self.localMedia!) { conversation, error in
self.conversation = conversation
self.conversation!.delegate = self
}
}
}
Please let me know if this helps at all!

Sinch Client works but messages aren't being sent

I'm using sinch and I've gotten the client to work by registering a user, but I can't send a message. When I click my send button, nothing happens. The required methods that need to be implemented, such as messageFailed(), messageDelivered(), etc. are not being called either. Does anyone know why?
Have you registered the one more user? Can you enable logging and share the full log output.
See comment below, user tried to send message to self

Sending mail without leaving app

I want to send a simple mail from my app without leaving it and I already have the code from other questions in this forum, but my problem is that when I send an email from my app, I have to open the mail program from apple so the mail is being sent.
I get a MFMailComposeResultSent when I send the mail from my app but it stays in the memory or somewhere else until I open the apple-mail-app.
I noticed when searching for my mistake that I never let the user enter his email address and password but they're both saved in the apple-mail-program, that's what I think why I need to open the standard-app.
Any suggestions on how to solve my problem? Any help is appreciated.
You did nothing wrong if you are getting a MFMailComposeResultSent. This is not about any username or password of the email account. The documentation says about MFMailComposeResultSent: Send may only be interpreted as a successful queueing of the message for later sending. The actual send will occur when the device is able to send.
Also your problem became a possible duplicate of: ios4.3.4: MFMailComposer doesn't send an email, but return MFMailComposeResultSent status

Storing chat messages with an irc bot

I am trying to code a simple irc bot that detects if a word is inside a chat message and then saves that message to a file. I have the correct 'on text' event set up, but I don't know how to access the message that was sent so I can save it.
on *:TEXT:*txt*:#:
{
var %message $msg
writeini Log.ini Message value %message
}
$msg is clearly wrong. Is there an identifier to have my bot access the messages in the chat, or is there a completely different way to do this? I can't seem to find anything online about this either.

Resources