I'm trying to send a pre-populated SMS via AS3 in Adobe AIR. It works perfectly on iOS, with the native SMS UI displaying with the pre-populated text. However on Android it's seeing the whole string as the phone number, showing the following error -
Invalid recipients(s): <0123456789&body=Hey! This is a test message.
http://google.com>
The code I'm using -
var number:String = "0123456789"
var callURL:String="sms:"+number+"&body=Hey! This is a test message. http://google.com";
var targetURL:URLRequest = new URLRequest(callURL);
NavigateToURL(targetURL)
1st) The & that you are using should be an ?
sms:+15105550101?body=hello%20there
Refer to RFC 5724 for details.
Note: on iOS8+ the & is correct, for iOS7 and under use an ;
2nd) Certain Android versions are just plain broken when it comes to including a 'body' in an SMS URI. You would need to look up the 'buggy' versions in Google's bug database.
Related
I am trying to create a link in an email that will open a mobile device's default texting app if pushed. Here is what I have so far:
a href="sms:;?&body=This%20is%20the%20body%20message."
I have tested it and it seems to work on iOS devices as well as some Android devices. However, on a Google Pixel 3, it opens the default messaging app but shows an error which reads Could not start conversation.
How can I change my code to successfully open a conversation with a blank recipient?
After hours of trial and error, I was able to prefill the Pixel (3XL), iOS (simulated in Xcode), and macOS Messages using the following structure:
Pixel: sms://+1${PHONE}/?body=${encodedString}
iOS: sms://+1${PHONE}/&body=${encodedString}
Give this a try from a link, I think you need a number and replace ; with ?
Send SMS
For non iOS you want to use (For your Pixel Example)
sms:phone_number?body=The_Message
For iOS you want to use
sms:phone_number;body=The_Message
Please look at the Signal icon in this screenshot:
My question is how to obtain the same result in a Codename One app. Suppose that my app has a variable like "int unreadMdg", how can I show the number of unread message in the app icon?
We currently only support this on iOS as it wasn't available on any Android device when we launched the feature and is still arguably flaky on Android.
For iOS support you can set the badge value via push notification (see the developer guide) or by using the API:
if(Display.getInstance().isBadgingSupported()) {
Display.getInstance().setBadgeNumber(unreadCount);
}
This is for IOS
Use this to make it displays a specific number
// Objective-C
[UIApplication sharedApplication].applicationIconBadgeNumber = number;
// Swift
UIApplication.shared.applicationIconBadgeNumber = number
I use the below code which works in different mobiles but only in moto e 4.4.4 version its not working.
Please help me how can I solve this.
getContentResolver().delete(Uri.parse("content://sms"), "address=?", new String[] {address}) );
in 4.4 and upper version of android you should make your app as default sms app to be able to write in sms database. to do so you can use link bellow to find out how you can make your app default you can see :
http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html
in this link you will understand how you can bring a message to your user to mark your app as default sms app.
I need to send a push notification to mobile devices that have registered on my notification hub.
The hub is set up to allow windows phone, apple and android devices to register, and I have the appropriate keys and certificates in place. (According to the documentation!)
I am using the latest release of the Microsoft.Azure.NotificationHubs namespace, version 2.16, as advised by the NuGet package manager.
I want to send one message, to all registrations as well as sending a message to a specific device. I can see the devices have all registered correctly with the hub, and have tags that allow me to send notifications to them.
I am trying to use the SendDirectNotificationAsync() method
that takes a Dictionary and a string tag as parameters.
I have also tried the SendNotificationAsync() method that takes a Notification object as a parameter.
Neither method causes a notification to appear on my windows phone with the parameters I have provided, so without an example or more information from the help files, I am stuck.
I cannot find any current examples using these methods and classes.
The examples I have found pre-date the release, and do not show what to send to the notification hub for a cross platform notification to work.
I know these have only just been released, but any help / guidance would be appreciated, as I have reached a complete dead-end with this.
Just a quick update...
Although I never got this to work as I wanted to (as described above), what I ended up doing was to use each platforms native notification as below;
var result1 = await hub.SendMpnsNativeNotificationAsync(windowstoast, mobileDeviceId);
var result2 = await hub.SendGcmNativeNotificationAsync(androidToast, mobileDeviceId);
var result3 = await hub.SendAppleNativeNotificationAsync(iOStoast, mobileDeviceId);
The 'toast' was formatted as per the individual platforms requirements in the documentation.
The 'mobileDeviceId' was the tag that each device registered with the notification hub.
So, clumsy, but it works reliably to achieve the same end.
I still would like to get the cross platform way to work though. Will look into it a bit more when I have time.
Is there a way to automatically send an SMS with Phonegap or Cordova on iOS and Android? If not is there a way to pre fill the text message in the native app so the user just as to confirm the message to be sent?
Just to add to KateMihalikova's answer (I don't have enough rep to add a comment on it) but her answer is correct except for the iOS >= 7 part; iOS 7 body is not supported (I believe only if you have already had history with the SMS number in question will it work, but I've not tested it); however iOS 8 has brought body prefill back: you have to replace the ; that was used for iOS <=6 with an & instead:
iOS 8: sms:+123456789&body=hello there
sms: schema
Android: sms:+123456789?body=hello there
iOS != 7: sms:+123456789;body=hello there
iOS = 7: sms:+123456789 - body is not supported
You can use link or javascript location:
Send SMS
window.location = "sms:+123456789?body=" + encodeURIComponent("hello there");
Default sms app is opened and prefilled with provided data.
Cordova plugin
Some examples:
https://github.com/hazems/cordova-sms-plugin
https://github.com/aharris88/phonegap-sms-plugin
Not tested
9.3.2015 edited with iOS 8
I can confirm that with ios7 the body text will work as long as the number being contacted has an existing chat history.