Android: Get and Open Email and remove Bluetooth - android

i want to choice a app to send email:only email app to send my email,i have read How to open Email program via Intents (but only an Email program) i used intent.setType("message/rfc822") ,it very well,but Bluetooth and email give me to choice,i want to remove Bluetooth,and want to Leave only email.can you tell me how to send email not to show Bluetooth to give mo choice;
edit: if i used Intent intent = new Intent(Intent.ACTION_SENDTO); the bluetooth is remove but add Text messages t0 give me choice.i also used
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri data = Uri.parse("mailto:?subject=" + subject + "&body=" + body);
intent.setData(data);
startActivity(intent);
the bluetooth also remove but also add add Text messages t0 give me choice.is there i way to only email app to send email?

Related

Send message to whatsapp onclick button to particular whastapp number or whatsapp group directly

friends i want my app to save the particular contact number and when any emergency is just on click button , message like "alert" need to be send to particular whats app number or whats app group how it can be done can u help me.please give the code directly to send . i do not want the code for sending text and selecting from whats app whom to send. i want my app first let save the any number before and in any emergency just click on button direct sending to particular whastapp number or group.
thanks in advance .
please help me to
You can try the follow
Intent sendIntent = new Intent("android.intent.action.MAIN");
sendIntent.setAction(Intent.ACTION_VIEW);
sendIntent.setPackage("com.whatsapp");
String url = "https://api.whatsapp.com/send?phone=" + "Phone with international format" + "&text=" + "your message";
sendIntent.setData(Uri.parse(url));
if(sendIntent.resolveActivity(context.getPackageManager()) != null){
startActivity(sendIntent);
}
This will open and intent with specific contact which you have specified.

How to send MMS without prompting to send it via gmail ,whatsapp or something else ?

When I am Using this code to send mms to specific user it shows me popup to send it via gmail,whatsapp,gtalk,message and etc. But in my case I just want to send that image as an mms to specific number that i will define in address field whithout showing any popup can any body tell me How to do this ? I googled for this and find lot of stuff on it.
Here is my code*strong text*
public void sendData(int num){
String fileString = "..."; //put the location of the file here
Intent mmsIntent = new Intent(Intent.ACTION_SEND);
mmsIntent.putExtra("sms_body", "text");
mmsIntent.putExtra("address", num);
mmsIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(fileString)));
msIntent.setType("image/jpeg");
startActivity(Intent.createChooser(mmsIntent, "Send"));
}
Using an intent (like you did) is the preferred way because it's easy to implement and let the user choose his favorite app for the task of sending the MMS.
That being said you can still implement yourself the operation and send the MMS programmatically from your app by crafting and sending the appropriate HTTP request.
The following answer will provide you all the information you need: How to send image via MMS in Android?

Android: how to pre-populate an SMS message

I am writing an application that needs to pre-populate an SMS message with the first name of the contact when using the stock android SMS messenger.
For example if my contacts name is Alex Smith.
When I select Alex Smith to type a message to, I want the text box to already have
'Alex, '
at the beginning of the SMS.
Please how can I achieve that?
Fetch the contact name from contacts, and do like as follows:
String contactName = "Alex"; // get it from selected contact
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "sms:" + phoneNumber ) );
intent.putExtra( "sms_body", contactName+"," );
startActivity( intent );
Just look over here:
Send SMS via intent
You use a Intent to send the SMS and attach some pre defined text via the EXTRA_TEXT attribute. Quite easy to do. And it works for the normal SHARE intent as well.
You can't change system apps, but you can send "share intent" from your app to SMS App. As you remember, when you push "share" button in some apps, you can share smth with SMS. (You'll have SMS with text that app put in intent). SO, put contact's name in "share intent" and send it to SMS app.
it's bit late, but i hope it will help future users.
void prePopulateSMS(final String mblNumVar, final String smsMsgVar) {
Log.d(TAG, "prePopulateSMS called. smsMsgVar: " + smsMsgVar);
Intent smsIntent = new Intent(android.content.Intent.ACTION_VIEW);
smsIntent.setType("vnd.android-dir/mms-sms");
smsIntent.putExtra("address", mblNumVar);
smsIntent.putExtra("sms_body", smsMsgVar);
startActivity(smsIntent);
}

show gmail screen directly... not thru selection

I am sort of new to android.
I am trying to send a msg via gmail and this is my code.
Intent intent = new Intent(Intent.ACTION_SENDTO);
String uriText;
uriText = "mailto:test#gmail.com?subject=Subject&body=this is test.";
uriText = uriText.replace(" ", "%20");
Uri uri = Uri.parse(uriText);
intent.setData(uri);
startActivity(Intent.createChooser(intent, "Select mailer"));
It works. But, before sending the msg, it shows a selection box
and asks me to choose either gmail or email.
How can I skip the selection box ?
Any help would be so appreciated.. Thanks.
How can I skip the selection box ?
You don't. You allow the user to choose what application they wish to use to send the message. Some users do not use Gmail.

Action Intent for Gmail in android?

I am creating an app in which user can share "something" by clicking on a share button.
The steps to share "something" are:
On clicking the share button the contact list should open
By selecting a contact (with valid a email address) the data should be sent directly to the selected contact from the sender's default email address(Gmail) without popping up a window for selecting an email client like "Gmail", "Dropbox" etc..
I managed to get the email id of contact with the help of
http://mobile.tutsplus.com/tutorials/android/android-essentials-using-the-contact-picker/
but after selecting a contact I get a pop up for selecting an email client like "Gmail", "Dropbox" etc..
here is my code so far
if( email.length() != 0 )
{
Intent sharingIntent = new Intent(
android.content.Intent.ACTION_SEND );
sharingIntent.setType("message/rfc822");
String shareBody =
"Hey buddy listen to this station it is awesome\n"
+ mNowPlayingSong.mAudioUrl;
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,
"I liked this song" );
sharingIntent.putExtra(
android.content.Intent.EXTRA_TEXT, shareBody );
String emailAddressList[] = {email};
sharingIntent.putExtra(Intent.EXTRA_EMAIL, emailAddressList );
startActivity( sharingIntent );
You cannot send email silently with the default application. You can only create an intent that will call an activity and that will fill in all the fields.
Other possibility is to embed your own email client into yours application. In this case, if a user provides credentials then you'll have a possibility to send a email silently. To implement the second options check this:
Sending Email in Android using JavaMail API without using the default/built-in app

Categories

Resources