want to develop an app that can automatically respond to a received text, include my location using gps/google maps in the returned message, and read out the received message using text to speech.
My first concern (what this question relates too!) is figuring out howto automatically reply to sms messages received. I have built a basic GUI and menu option. There is an EditText field that uses shared_preferences to remember the string so far.
How do I go about adding this string to an sms message, and making the messege send to whomever just texted me? I have a decent understanding of java but I havn't been about to find any clear examples and an a bit confused.
Any help would be great!
Thanks
(Basically a java oracle version of the app inventor application "NoTextWhileDriving2")
For an android specific solution you can use the SmsManager class. Here is some example code taken from a similar question that deals with sending an sms message from an android application.
Have a look at SmsMessagingDemo from the android development API demo page. Below is a snippet of the sending code.
// Watch for send button clicks and send text messages.
Button sendButton = (Button) findViewById(R.id.sms_send_message);
sendButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (TextUtils.isEmpty(recipientTextEdit.getText())) {
Toast.makeText(SmsMessagingDemo.this, "Please enter a message recipient.",
Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(contentTextEdit.getText())) {
Toast.makeText(SmsMessagingDemo.this, "Please enter a message body.",
Toast.LENGTH_SHORT).show();
return;
}
recipientTextEdit.setEnabled(false);
contentTextEdit.setEnabled(false);
SmsManager sms = SmsManager.getDefault();
List<String> messages = sms.divideMessage(contentTextEdit.getText().toString());
String recipient = recipientTextEdit.getText().toString();
for (String message : messages) {
sms.sendTextMessage(recipient, null, message, PendingIntent.getBroadcast(
SmsMessagingDemo.this, 0, new Intent(ACTION_SMS_SENT), 0), null);
}
}
});
You have to setup a BroadcastReceiver for receiving of SMS messages. Very nicely described in Android Developers Blog.
There is also an open source application working with SMS on code.google.com android-smspopup.
Related
Is there any way to send sms using SmsManager without open the App.
I am using FirebaseMessagingService and i got remoteMessage from onMessageReceived method its Contains Mobile No and Message.
Then i am sending SMS using using SmsManager. and also i declared permission.SEND_SMS/RECEIVE_SMS in manifest file.
This is My Code:
public void onMessageReceived(RemoteMessage remoteMessage){
String mobile = remoteMessage.getData().get("mobileno");
String message = remoteMessage.getData().get("message");
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(mobile, null, message, null, null);
}
Its Working on when App is Running. but not working on when app is not running in background.
Is there any way to SEND sms when App is not running.??
Please help me.. Thanks...
Finally i got answer from firebase console. i did some mistake in Nodejs Server code after corrected that code its working fine...
I recently made an app which could send messages using the android smsManager api, and was wondering if there is a way to send a sms message through the an android api where the id of the sender is spoofed.
this is the current state of the code I used which sends the message to my cell:
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(recipient, scAdress, msg, null, null);
I've tried to edit the scAddress, but the message doesnt send (I was seeing if that would work, and wasn't sure what scAdress was)
I am also aware that I could use a site like Twilio or Tropo, but I want to send the message through the sim card, not over the internet.
I know you are interested in doing this on your current SIM via other means. Sorry I can't be of more help there. However, this does sound like a fun way to play with Twilio Wireless. You should check out the documentation here.
I have my NFC class which I assume people know what it looks like if you are looking at this question. So OnCreate, I do:
mNfcAdapter.setNdefPushMessageCallback(this, this);
to be able to send messages and then I do:
public NdefMessage createNdefMessage(NfcEvent event){
NdefMessage msg;
msg = new NdefMessage(new NdefRecord[] {
createApplicationRecord(this.messageToSend.getBytes())
});
return msg;
}
to send my message. and I have some code to receive a message as well but then I want to send another message back while the devices are still in "Connected" mode. How can I manually give a "send message" command?
Your application gets a single chance to send out the message using setNdefPushMessageCallback. Once the message has been transfered you get the completionCallback (if you want to). Afterwards you can't interact with NFC anymore.
Sending a second message after you got your completion is unfortunately not possible with the API as it is right no.
Technically there is no reason for this by the way. Google could add the functionality with ease. It would only take them a day or two. In Android 2.3 there already was an undocumented way to access the LLCP (base protocol of Android Beam) protocol from applications. This is gone since Android 3.0
I have a text messaging app that I want users to be able to text another app of mine on someone else's phone that will show up within the app. Printed on screen. I have one app that will send the message and one app on the receiving device that will display the message. How would I go about doing this?
The receiving app is an opengl app that will display the message in front of a 3d model from the sending app.
If someone could help me out or get me going in the right direction, I would greatly appreciate it. Thank you for your time.
EDIT: This is what I'm doing. I'm making a live wallpaper that women can put on their phone, a seperate "regular" app will allow the husband, fiance, etc to send a message to the lwp on the significant others phone that will display at the top half of the lwp screen.
public void sendSMS(String phoneNumber, String message)
{
PendingIntent sentPI = PendingIntent.getBroadcast(this, 0,
new Intent(SENT), 0);
PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0,
new Intent(DELIVERED), 0);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);
}
You can do something like this for sending the sms.
Yes, it's possible.
Use SMSPopup as a working Android project you can use. It has the two parts you need: the sending part and the receiving part, and it's open source. Here it is on Google Play.
The only issue is that the user probably won't want those application messages intermingled with his normal SMS messages.
So you'll want to tag your application text messages with a unique keyword so that the receiving app knows it's a message for itself and no one else. And by tagging, I just mean to insert a unique keyword at the beginning of its subject line.
And your receiving app will have to register a BroadcastReceiver with a priority of 100 so that if it detects a message intended for itself, it can just delete it from the content provider and just do an AbortBroadcast so that the other text messaging apps don't beep for a message that wasn't meant for them in the first place.
In that sense, SMSPopup probably already does 90% of what you need. SMSPopup doesn't automatically delete the sms it receives, nor will it filter them on a particular keyword, but it must silently swallow them so that the normal notification system for sms doesn't get triggered (since SMSPopup provides its own notification popup interface instead).
Hi Steve we have RabbitMQServer to send messages between apps. We should configure the server and need to implement functionlities to send and receiving messages.
You may get details about RabbitMQ server at http://www.rabbitmq.com/.
Currently I have a button that when pushed calls the Intent below.
Intent sharingIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
sharingIntent.putExtra(Intent.EXTRA_EMAIL,
new String[] { toString });
sharingIntent.putExtra(Intent.EXTRA_SUBJECT,
"New Files from Safe Storage");
sharingIntent.setType("text/*");
startActivity(sharingIntent);
This intent then uses the default share activity to share the email with my attached file (which i took out for this example). When this code goes off it opens the gmail activity for me, but i still need to push the send button even though everything is filled in. Is there a way to make this instead just send automatically without showing the user the activity and having them forced to push "Send"?
Have a look on the following link, there is an answer for your question.
Sending Email in Android using JavaMail API without using the default android app(Builtin Email application)