I am trying to share data from my app to other app like sms or any other app. I have a app where I need to send or share some data to apps like sms or fb messenger. Using this link through I can open up the app and add data into text box using this code:
Intent sendIntent = new Intent();
sendIntent.setPackage("com.sms or fb");
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
sendIntent.setType("text/plain");
startActivity(sendIntent);
Using this app I can open up the other app and add value in text area my question is is there any way by which I can trigger click or send event to send automatic message to other app like sms facebook. If so how I have seen google app where I used my voice to send hi to my whatsapp contact so this method is there google app can send message and trigger event using my voice. My question is how can I trigger the event send using my android code. If rooted system is out there I can also use that.
None of the answer is even close to what I want to solve no answer deserves bounty.
I don't know if it works but there is a SMSButtler App which replys automatic on receveid SMS. The good thing is that the app is opensource and you can download the code from this Github post.
I can't give you a answer about your Whatsapp problem but I analysed the code and I got this Method out of there:
To automaticly send a SMS message you first need to create a SMSManager
SmsManager sms = SmsManager.getDefault();
and then just send a text message
sms.sendTextMessage(destinationAddress, scAddress, text, sentIntent, deliveryIntent);
Parameter:
destinationAddress
the address to send the message toscAddress
is the service center address or null to use the current default SMSCtext
the body of the message to sendsentIntent
if not NULL this PendingIntent
is broadcast when the message is successfully sent, or failed.deliveryIntent
if not NULL this PendingIntent
is
broadcast when the message is delivered to the recipient. The
raw pdu of the status report is in the extended data ("pdu").Important: Using this method requires that your app has the android.Manifest.permission_SEND_SMS permission.
Note: There are also other Methods of this class where you can for example send images or other content.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With