0

I want to build an application where i am able to attach an image with the email, open the image and set it as my wallpaper. I wanted to make it cross platform so can you tell me if its possible using phonegap or do i have to build a native application for iphone and android?

user229044
  • 232,980
  • 40
  • 330
  • 338
Khush
  • 867
  • 1
  • 19
  • 46

2 Answers2

0

Hello if you want to just attach your image with email then using this code you can do this..

ArrayList<String> str = new ArrayList<String>() ;
ArrayList<Uri> uris = new ArrayList<Uri>();

//convert from paths to Android friendly Parcelable Uri's
for(int i=0; i<ayy_Images.size(); i++)
{
   if(ayy_Images.get(i) == null)
    {
       str.add("");
    }
    else
    {
       str.add(ayy_Images.get(i));
    }
}

for (String file : str)
{
   File fileIn = new File(file);
   Uri u = Uri.fromFile(fileIn);
   uris.add(u);
}

startActivity(Intent.createChooser(new Intent(Intent.ACTION_SEND_MULTIPLE).setType("audio/wav").setType("image/jpeg").setType("message/rfc822")
                            .putExtra(Intent.EXTRA_EMAIL, emails)
                            .putExtra(Intent.EXTRA_SUBJECT, subject)
                            .putExtra(Intent.EXTRA_TEXT, strDetails).putExtra( android.content.Intent.EXTRA_STREAM, uris), "Send your email in:"));             

ayy_Images is a ArrayList which contains the list of images.

anddev
  • 3,144
  • 12
  • 39
  • 70
-1

For iPhone sdk you attach image as :

NSData *photoData = UIImageJPEGRepresentation([UIImage imageNamed:@"anImage.png"], 1);
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
[picker addAttachmentData:photoData mimeType:@"image/jpg" fileName:[NSString stringWithFormat:@"image001.png"]];

For " open the image and set it as my wallpaper "

It is not possible via code in iPhone. You have to use the Settings.app

Maulik
  • 19,348
  • 14
  • 82
  • 137