I am trying build an sms based application in AIR (Flash)
Got this code from an old link
str = "sms:1-415-555-1212";
var urlReq:URLReq = new URLRequest(str);
navigateToURL(urlReq);
but this one is 5 years old and lot has change and even Flash is now Animate CC
so can anyone help me in this
5 years, but still nothing changed - your code will work on modern devices.
You can use the URL with sms: - This is supported in all mobile OS:
private function sendSMS(phone:string):void
{
navigateToURL(new URLRequest("sms:" + phone));
}
For example:
navigateToURL(new URLRequest("sms:+00133234534"));
Bonus Tip!
Send a phone call: navigateToURL(new URLRequest("tel:" + phone));
Send an email: navigateToURL(new URLRequest("mailto:" + email));
Related
i am trying to find a way to send SMS and make a phone call from a samsung gear s app.
the documentation is mostly missing and searching for this did not lead to much findings.
has anybody worked with that? is it at all possible?
as an alternative, if the app cannot send SMS or make the call, is it possible to start the default apps (similar to Android intent for SMS/Phone app or iOS openURL).
thanks.
#memical - I have found a workaround to launch message/sms app using the app id.
<p onclick="hackSMS();">Send SMS</p>
<script>
function hackSMS() {
tizen.application.launch("com.samsung.message", function(){console.log ("Launched")});
}
</script>
Remember to add this http://tizen.org/privilege/application.launch priviege in your apps config.xml
Note: I tried other methods also like using exposed tizen platform api's for web apps to launch some predefined app control. But it is working for Call and not for sms.
here is what i find so far:
to make a call from a Gear S app use the following code:
var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/call", "tel:001....");
tizen.application.launchAppControl(appControl, null,
function() {
console.log("ok");
},
function(e)
{
console.log("error: " + e.message);
},
{
onsuccess : function()
{
console.log("ok 2");
},
onfailure : function(er)
{
console.log("error 2: " + er.message);
}
});
sending SMS is not possible at this time.
There is no messaging API implemented on Tizen for wearable devices. You can check it yourself by calling:
console.log(tizen.messaging);
It will return 'undefined'
It means that you can't programmatically send or read an SMS or an email from your wearable device using Tizen messaging API.
To open the app for make a call try this code:
Uri number = Uri.parse("tel:"+telNumber);
Intent openCallIntent = new Intent(Intent.ACTION_DIAL, number);
startActivity(openCallIntent);
To make a call:
Uri number = Uri.parse("tel:"+telNumber);
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(number);
startActivity(callIntent);
To send an sms:
Intent sendSmsIntent = new Intent(Intent.ACTION_VIEW);
sendSmsIntent.setType("vnd.android-dir/mms-sms");
sendSmsIntent.putExtra("address", telNumber);
sendSmsIntent.putExtra("sms_body","Whatever you want");
startActivity(sendSmsIntent);
Similar questions to this one are already answered in stackoverflow
Try this which is very simple as compare to using the platform APIs.
http://www.w3.org/TR/mwabp/#bp-interaction-uri-schemes
The most broadly supported scheme is tel: as described in RFC3966
[RFC3966]. Code such as the following can be used to enable
"Click-to-Call":
[PHONE-NUMBER]
Note that [PHONE-NUMBER] should always be entered using the full
international prefix (e.g. +1-201-555-0111) to ensure that it works
outside of its home country.
Similarly RFC5724 [RFC5724] can be used to send a GSM SMS (text
message) as follows:
[PHONE-NUMBER]
Note that at the time of writing support for this RFC is limited and
device compatibility should be verified before deployment.
I am developing a webview app with android and I have a link which when clicked a call is made. Currently I have the following:
if (tablet == false) {
html += '<a rel="external" href="tel:21212121">';
}
else {
html += '<a rel="external" href="facetime:\\21212121">';
}
From the code above I am checking if the device is a tablet or not. If it is a normal mobile I use the tel link if it is a table I use facetime. Now I know that facetime is used only on IoS so I can change it to skype etc.
What I would like to is to prevent the Message "Protocol isn't supported" from showing.
Thanks
I am using the following snippet to log all available (and unavailable) voices currently on phone:
ArrayList<String> availableVoices = intent.getStringArrayListExtra(TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES);
String availStr = "";
for (String lang : availableVoices)
availStr += (lang + ", ");
Log.i(String.valueOf(availableVoices.size()) + " available langs: ", availStr);
ArrayList<String> unavailableVoices = intent.getStringArrayListExtra(TextToSpeech.Engine.EXTRA_UNAVAILABLE_VOICES);
String unavailStr = "";
for (String lang : unavailableVoices)
unavailStr += (lang + ", ");
Log.w(String.valueOf(unavailableVoices.size()) + " unavailable langs: ", unavailStr);
The logged result is somehwat bewildering, since I know beyond certainty that I have multiple languages installed and I can even hear the TTS speaking in eng-USA, yet the log shows:
1 available langs: eng-GBR,
30 unavailable langs: ara-XXX, ces-CZE, dan-DNK, deu-DEU, ell-GRC,
eng-AUS, eng-GBR, eng-USA, spa-ESP, spa-MEX, fin-FIN, fra-CAN,
fra-FRA, hun-HUN, ita-ITA, jpn-JPN, kor-KOR, nld-NLD, nor-NOR,
pol-POL, por-BRA, por-PRT, rus-RUS, slk-SVK, swe-SWE, tur-TUR,
zho-HKG, zho-CHN, zho-TWN, tha-THA,
Why is this inconsistent behavior? (note that eng-GBR appears in both the available and unavailable lists...)
It turns out that as far as text-to-speech in Android 2.x goes, it's the wild west out there: Every and any installed 3rd-party TTS engine can modify the output of this EXTRA_AVAILABLE_VOICES function however they desire, regardless whether checked/unchecked or selected/unselected as default.
I just tried uninstalling all TTS engines from my phone, leaving only the hard-coded Pico, and the result match exactly what I expected:
6 available voices: deu-DEU, eng-GBR, eng-USA, spa-ESP, fra-FRA,
ita-ITA,
0 unavailable voices:
I don't mind the output of this function dynamically refer to the currently selected (i.e. default) TTS engine, but the fact is that once a 3rd party TTS engine is installed, this function's output doesn't make any sense, because it ignores any settings.
Also note that the name misleading: It's available languages, not voices!
I am posting this answer with the hope that it will help someone save the time & agony of discovering this the hard way.
I am getting different numbers from Contacts and passing them to SMS application. I am using the following:
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "sms:"+numbers) ); //numbers separated with ;
intent.putExtra( "sms_body", body );
startActivity( intent );
The problem is if I separate numbers with ' ; ', it does not work on Galaxy S but works on others like HTC, Samsung Gio etc... On Galaxy S, it works if I separate numbers with comma ' , '. So how to resolve this issue?
Normally using a semicolon (';') is the right choice to separate phone numbers. So you should use this. It might be due to vendor specific adjustments or custom vendor applications that it does not work on Galaxy S for example.
I would propse to use semicolon everywhere except for Samsung devices. You unfortunately have to do this ugly vendor specific decision within your source code.
String separator = "; ";
if(android.os.Build.MANUFACTURER.contains("Samsung")){
separator = ", ";
}
// set the numbers string with the use of 'separator'
Note that the solution provided (using the os.Build.MANUFACTURER string) does not work in all situations!
I have several users that use a Samsung device which run's a Cyanogenmod version of Android. In this situation the MANUFACTURER string contains "Samsung", but the separator should be a ";" instead of the ",". I did not find a solution for this issue yet...
iam just practicing with phone gap for android app. I found a piece of code in docs.phonegap.com, regarding adding contacts
function onDeviceReady()
{
alert('onDeviceReady: PhoneGap1');
var myContact = navigator.contacts.create({"displayName": "Test User"});
alert('onDeviceReady: PhoneGap2');
myContact.gender = "male";
console.log("The contact, " + myContact.displayName + ", is of the " + myContact.gender + " gender");
}
When i run this i am getting only the alert box and the name is not added in my contacts. How to add the contacts....
Please tell me how to add data and open the device default contacts...
Simon Mac Donald has written a great blog post on contacts with PhoneGap and Android.
http://simonmacdonald.blogspot.com/2011/09/saving-contacts-with-phonegap-android.html
It should help you out as there are a few steps to it.
The quick answer for those of you searching, is that you have to call
myContact.save()
in order to persist the contact that you just created.