Sending email and sms one after the other in WP8.1 (WinRT) - email

I'm working on a SOS app that is supossed to send emails and/or sms when the user needs it to. This will happen using the contacts that the user added to the app. At the moment the user can add 4 of these contacts, regardles of the type (email/sms).
I'm already able to send sms OR emails using
await ChatMessageManager.ShowComposeSmsMessageAsync(chatMessage);
or
await EmailManager.ShowComposeNewEmailAsync(emailMessage);
The problem is doing both things, one after the other.
If I call both of this functions at the "same time", only one of them will show the respective page. Since OnNavigatedFrom and OnNavigatedTo events do not fire in these conditions, is there any other kind of event that fires when it comes back from the pages or some other way to wait until one of the pages is dismissed?
Thanks

Ok I've found the solution
Window.Current.VisibilityChanged
fires in this case. I'm able to figure out when the application is getting visible again and assume that the SMS was treated, launching the email at this stage.
I just start listening to the event before composing the SMS and release it when it comes back. It seem so simple now..
(Still don't know why OnNavigatedTo doesn't work)
Launch 2 SMS Compose tasks in Windows Phone 8.1 RT App pointed me in the right direction.

Related

Restcomm USSD - do not return a dialog

I have a working USSD gateway, messages between the user's device and the app are set.
But there is a particular type of message where I don't want to send any dialog back to the user. When a user puts a sim inside a phone for the first time, an automated USSD call is made - I receive it and handle it, to send a configuration SMS or such.
The thing is, then I don't want to send anything to the user - there is no need for the user to be aware of that call. I didn't succeed to do that up to now. Using type End, Unidirectional or Abort didn't change anything. The message processUnstructuredSSRequest_Response still has a string that will show on screen, needing the user to click the "OK" button.
How can I make this happen ?
Found it. It's the prearrangedEnd dialog attribute, look for it in the doc https://www.restcomm.com/docs/core/ussd/USSD_Gateway_Admin_Guide.html#_attributes

How to handle multiple push notifications with user data arrived at different times?

My app is receiving APNs sent from server to Apple backend. Naturally a user may not open the app once a notification arrives to user's device. In meantime my server may push more notifications. They all contain some user data that is important when a notification is processed. So how to deal with it? iOS won't bundle and give me a batch, will it?
Here are ways how I am going to tackle it, none of which is simple.
Server keeps track of not seen data and upon arriving a new request always sends a batch of all new notifications, reflecting the count as badge count.
Client is opened by taping on notification popup. In this case it has all needed data in didReceiveRemoteNotification.
OR
Client ignores notification popup and opens app (possibly later) by tapping on app icon. In this case didReceiveRemoteNotification is not called and thus app has to fetch all needed data from server.
OR
Server never sends any user data and client always checks for new stuff every time it starts or fetches data in didReceiveRemoteNotification.
Anything else? Something simpler I am missing?
Number 4 is the right approach. There is no guarantee that any of your app code will run when an APN is received, except on iOS7. So when your app starts, it has to check with your servers for any new information that it should display.
It's simplest to code this to alway ask your servers for the latest information to display, rather than rely on the information in the APN. Use the information in the APN only to determine which new information to navigate to, so that the app displays whatever the user tapped on.
This has changed with iOS7, where you can use the remote-notification background mode to be launched whenever a push message arrives. See https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/application:didReceiveRemoteNotification:fetchCompletionHandler:

iOS ABPersonViewController: Returning to app after phone call/message/email

I'm using an ABPersonViewController and I was wondering if it is possible to return to my application after making a phone call or sending an email/message instead of exiting to the respective native apps.
On the iPhone Contacts app, you can make a phone call by pressing the phone number field. Ending the call automatically takes you back to the contact screen. You can also send an email and message by clicking on the respective fields (though ending the email/message action does not take you back to the Contacts).
To be more specific, tapping on "mobile 1 (555) 555-5559" should make a phone call to that number (my app already does that). However, when I end the call, I would like to be directed back to my app and not the native iOS Phone app. I would like similar actions for sending an email and message too.
If this is possible, it would be great if someone could share the solution! Thanks for any help.
it is possible to return to my application after making a phone call or sending an email/message instead of exiting to the respective native apps.
AND
Ending the call automatically takes you back to the contact screen
In SHORT : It is not possible because Apple/iOS Does not Provide this type of Feature.

Send SMS programmatically, without the SMS composer window

Until yesterday I thought that it was not possible to send background SMS without using the IOS SMS interface (Which many people here assure also). However, today I downloaded a new app called SmartSender, which schedules your SMS and then sends it automatically.
I tested it and the SMS is not actually sent on background, but a local notification appears and when you click on it to bring app to foreground, the SMS is sent automatically.
How could this be achieved?
Maybe Apple approved the app because the interface is very clear on what you are doing and what you are sending, but how can you send SMS without showing the interface?
Update: The scheduled SMS appear on my phone Messages app as sent, so I don't think that they are using another service to send SMS, also the receiver phone is indicated that the SMS was sent from my phone.
Update 2: OK I'm using and watching the app doing this, so IT IS POSSIBLE without showing the default interface, I'm not asking whether this can be done or not. I am using it with all internet connections turned OFF, and the message is sent from MY PHONE so it appears on the MESSAGES APP. So the app is not using any third party service.
Update 3: I will accept my own answer, in fact it is not possible; however it was when the question was answered. The App in question has now specified in its description that it won't work in iOS 6, so I think Apple patched some bug that could be exploited to achieve this functionality.
Having tried the app, I can verify that it does send SMS programmatically, without showing the SMS interface. And it clearly doesn't happen through a third-party service, since the message gets sent as an iMessage when possible.
It's also clear from all the other answers that there aren't any public APIs for sending SMS programmatically, so the developer must have used a private API and yet somehow snuck this app through the approval process.
Specifically, it seems he used the CoreTelephony API. This post on SO describes the procedure. Apparently you'll also need to get your hands on the CoreTelephony header files somewhere.
I've been looking into the SMS send/receive limitation on iOS for a few days, using iOS 6 and XCode 4.5 (latest as of writing). I was curious about this SmartSender application so I purchased it.
I don't know if it's because I only tried it on iOS 6, but I get the standard message controller (MFMessageComposeViewController) to send messages. I have tried delayed send - I get the message controller at prescribed time and have to manually click on Send. I have tried immediate send - that pops up the controller and I also have to manually click on Send. If I click on Cancel, the app actually loops me back into the message controller (I can't cancel unless I kill the app!)
So true, this allows entering messages from a custom UI, but then the message itself is copied into the MFMessageComposeViewController and that is what sends the SMS. So App Store approved, but nothing like what we're all looking for!
You can not send SMS programmatically in background, you can use following third party API to send the text message (SMS).
http://www.twilio.com/
http://www.nexmo.com/
https://www.tropo.com/
I would suggest nexmo, its easy to use and support international messages also.
In fact it is not possible; however it was when the question was answered.
The App in question has now specified in its description that it won't work under IOS 6, so I think apple patched some bug that could be exploited to achieve this functionality.
You can use:
[[UIApplication sharedApplication] openURL: #"sms:+3912345678"];
it doesn't work on simulator... and you cannot send programmatically sms!
Tested on iOS < 6.
There is no way to send SMS programmatically. You may want to investigate a 3rd party service service for sending SMS like Twilio.

iPhone: How to disable editing when MFMessageComposeViewController shows up

Is it possible to prevent editing when MFMessageComposeViewController shows up?
'Cause I want the body of SMS can't be changed by user and I think it's still legal.
Please help!
No the user has final say when using the MFMessageComposeView.
Your app is also prohibited from changing the content/recipient/body of the email when the
view slides up.
If you could do this it would be easy to paste in a different recipient, sniff the content provided by the user etc. etc. (especially in the Message App, you could swap the phone number and do terrible things.).
I guess this is the logic behind, you get to pre-populate the message, but the user decides from there on and until "Cancel" or "Send".
You should probably build a web service where you have control over the data
when it hits the server and make an interface for that on the phone.