Issue
I am implementing one application.
Based on my application i am created class named "RepeatingAlarm.java"
My RepeatingAlarm class extends broadcastrecevers.
I am calling the above class in every one hour.
My requirement is,when this class is called
I want to get a file from sdcard and send this file through email.
How to do this?
Solution
Add these inside onReceive method in your BroadcastReceiver.
File file= new File(Environment.getExternalStorageDirectory()
+ "/filefolder/"+"filename");
Uri u1 = null;
u1 = Uri.fromFile(file);
Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
sendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Sending a file");
sendIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]
{"me@gmail.com"});
sendIntent.putExtra(Intent.EXTRA_STREAM, u1);
sendIntent.setType("text/html");
context.startActivity(Intent.createChooser(sendIntent , "Send mail..."));
Answered By - Manikandan Answer Checked By - Marilyn (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.