Sending an SMS using Google Voice - android

I have an app where I need to be able to send SMS messages. I have the code to send them directly, but I would like to give the option to use Google Voice to users who don't have messaging plans. Does anyone know how to do this? I can't seem to find the way. Here is the way I am doing it now:
StringBuffer buffer = new StringBuffer();
buffer.append("GEOC ");
buffer.append(mLogType.getSelectedItemPosition() == 0 ? "#" : "x");
buffer.append(mGeocache.getWaypoint()).append(" ");
if(mLogEdit.getText().length() > 0)
{
buffer.append(mLogEdit.getText().toString());
}
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("41411", null, buffer.toString(), null, null);

You want to use an SMS Intent.
That will give the user the option to select (or skip this step if he already have a default option) which SMS sending utility he want's to use.
several applications register themselves as such, such as skype, yahoo hub, google voice, etc.
So using a Intent, you tell android to use whatever the user wants to send the text message to a sms recipient.

It's my belief that the user must have a google voice account setup and have the voice app installed. Then when you fire an intent to send an sms it will be their preference to use google voice or not.

I've found a site where they've written their own google voice java library that you can import into your app and use. I just downloaded it yesterday so can't help with specific yet, but go ahead and take a look. It looks really promising.
http://code.google.com/p/google-voice-java/

Related

Create Message voice action for non en-us locales

I would like to know which are my posibilities as a developer to implements a send message voice action, in a messaging app (like a custom Telegram app), for spanish users. I want to implement the send new message action, I does not interested in replying to received messages (this is already implemented).
This is an example of I want to implements:
Create Message action
The user tells an utterance like "I would like to send a message with whatsapp".
A widget asks for a contact to send the message (if the user did not especificated one).
The app sends the message.
This is the same working example for spanish language: Create Message action (spanish)
I already know that there are built-in intents but the CREATE_MESSAGE built-in intent is only available for en-us locale. I also checked the custom intents but there are also only availables for en-us locale as I know. Which more options do I have?
PD: My final goal is to make the app compatible for Android Auto so I'm making it compatible with google assistant first.
Thanks in advance.
As you note, the actions.intent.CREATE_MESSAGE BII is only available in en-US right now. This is probably the best one, since it provides getting and sending a message without any additional work.
You may want to see if actions.intent.OPEN_APP_FEATURE will work for your needs. It has the downside that it does not have the fields available in CREATE_MESSAGE, but it might be a useful way to open the app.
However...
If you're planning on targeting Android Auto, that platform is even more restricted. If you're building an Android Auto app, you are limited to use only the actions.intent.GET_PARKING_FACILITY or actions.intent.GET_CHARGING_STATIONS BIIs. If you are willing to have it return a widget, you get a little more flexibility in what BIIs it accepts, but these don't let you send a message or open the app (even in en-US).

Android mobile number verification

Hi guys I need help from you all in Android mobile number verification process. I have a android phone I just need to verify the otp but in this case they using the auto verification method is it possible to verify my otp through fwd the msg or by using prank message app Pls anyone help me to solve my problem and thx in advance...
Assuming that you are asking for "how to implement OTP verification". There are number of ways to tackle this. Please look at the below link for two ways of achieving this using Google authenticator or using a SMS gateway.
Android one time password (OTP)
here is the tutorial to read the incoming messages using Broadcast receiver if you are going to use the second method.
"Reading incoming messages using broadcast receiver."
I believe you are trying to implement a way you can implement your own TTS (Text-To-Speech) Verification system that prompts the user to enter in the code.
If so, you can use Nexmo's Text To Speech Prompt.
All you have to do is make an HTTP call (For example: https://api.nexmo.com/tts-prompt/json)
From here you can use the parameters you want such as,
text - Body of the text message to be read to the end user
machine_detection - How to react when an answering machine is detected
lg - To determine what language the text is read in
bye_text - Body of the text message played after digits are entered successfully
failed_text - Body of the text message played after 3 failed attempts
There are many other parameters you can work with and customize your TTS prompt to capture/confirm data.
Full disclosure, I work at Nexmo
You can see more information how to implement this here

How I can send message in android without show message in the SMS Inbox?

Im can send sms with this code :
SmsManager manager = SmsManager.getDefault();
manager.sendTextMessage("5556", null, "Hi Havij", null, null);
But I dont like my message go in Inbox ! I want dont show it Nowhere ...
One possible solution might be deleting that SMS, But according to Google Docs after 4.4 no app can delete messages except the default messaging app:
Also, the system now allows only the default app to write message data to the provider, although other apps can read at any time. Apps that are not the user's default can still send messages
and for more info I suggest u see this.
UPDATE
after a little search I found what you need but as I told you before it seems its impossible in android 4.4 but if you want to do such work with lower versions of android please take a look at
this
One possible solution is you may send data SMS.
SmsManager smsManager = SmsManager.getDefault();
byte[] messageInBytes = stringMessage.getBytes();
smsManager.sendDataMessage(Mobile_no, null, SMS_PORT, messageInBytes , null, null);

How can set system preference programmatically let prompt message don't display?

I use the following code to forward sms, but a system prompt message displayed, how can set system preference programmatically let prompt message don't display?
private static void ForwardSMS(MSms myMSms, MRule rule) {
SmsManager smsMgr = SmsManager.getDefault();
for (String toAddress : rule.receiverNumberList) {
smsMgr.sendTextMessage(toAddress, null, myMSms.body, null, null);
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(PublicPar.myContext);
if (prefs.getBoolean("SaveSentBox", true)) {
SaveToSentBox(toAddress, myMSms.body);
}
}
}
This kind of prompt is for the users' own protection, and the Android API does not allow developers to disable it. So in short: There is no way to do this legitimately.
See, The image you have pasted here is asking the user about giving the permission to the app for sending SMS which may cause him money. Wouldn't you like to be warned in such cases where you can loose your charge because of the App.? So the Android doesn't provide any authority to the developers by which they can harm users credits or charges without even telling them.
But yes, as you can see there are options provided to "Remember the Choice". That means if users is aware of this fact once, and allows the app by clicking "Always Allow", next time there will be no popup to the user before sending the SMS.
So no matter what the app is, the Android API will always be loyal to the user and tell him about the loss me may suffer because of any App.

how do I add a hyperlink in sms message in android phone?

I want to send a sms message with the message body like "where am I?"
when I click "where am I?", it will take me to the google map website with my location.
My question is that how can I add this hyperlink in the "where am I?" message text?
Is there any example that I can study?
SMSes are text-only, and they only allow 160 characters. What you are suggesting would include 'where am I?' in the 160 characters but also somehow include a very long web address.
The first thing you might want to do is make use of some sort of URL-shortening service. I don't have one that I can personally recommend but there are Django apps, among other things, and online services that you can hook into with an API (like bit.ly). That will get you a unique link to easily fit in the available characters of an SMS.
Most smart phones will parse a link and make it 'clickable', even if it is in an SMS. So, for example, you could make the text read:
Where am I? www.linkgoesh.ere/somehash
The user should be able to click on the link and visit your website. It's not as elegant as what you're suggesting, but SMS is a (necessarily) limited format.
Try this code, it should resolve your issue.
String uri = "http://maps.google.com/maps?saddr="+latitude +","+longitude;
SmsManager smsManager = SmsManager.getDefault();
StringBuffer smsBody = new StringBuffer();
//long number = Long.parseLong(get_number);
smsBody.append(Uri.parse(uri));
smsManager.sendTextMessage(get_number, null, smsBody.toString(), null, null);

Categories

Resources