Thursday, 21 February 2013

Integrating Jasper Reports With Struts2-jasper Plugin

For integrating your jasper report into the web application with struts2-jasper-plugin,

you need to do the following things

struts.xml

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
 <constant name="struts.devMode" value="true" />
 <constant name="struts.action.excludePattern" value="/servlets/.*" />
 <package name="default " namespace="/"
  extends="struts-default,json-default,jasperreport-default">
  <result-types>
   <result-type name="jasper" class="org.apache.struts2.views.jasperreports.JasperReportsResult"/>
  </result-types>
  
  <action name="myJasperTest" class="com.jasper.admin.action.JasperAction">
   <result name="success" type="jasper">
    <param name="location">/WEB-INF/classes/jasper/our_compiled_template.jasper</param>
             <param name="dataSource">myList</param>
             <param name="format">HTML</param>
             <param name="imageServletUrl">/servlets/image?image=</param>
         </result>
     </action>
    </package>
</struts>

in the above struts.xml observe orange color line, these lines are very important for struts-jasper-plugin


JasperAction.java


package com.jasper.admin.action;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.interceptor.ServletRequestAware;

import net.sf.jasperreports.engine.JasperCompileManager;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @author KONDA REDDY
 *
 */
public class JasperAction extends ActionSupport implements ServletRequestAware{

    /** List to use as our JasperReports dataSource. */
    private List<Person> myList;
    private HttpServletRequest request = null;
    
    /* (non-Javadoc)
  * @see org.apache.struts2.interceptor.ServletRequestAware#setServletRequest(javax.servlet.http.HttpServletRequest)
  */
 public void setServletRequest(HttpServletRequest request) {
  this.request = request;
 }


    public String execute() throws Exception {

        // Create some imaginary persons.
        Person p1 = new Person(new Long(1), "KONDA REDDY", "LINGAMDINNE");
        Person p2 = new Person(new Long(2), "PRASAD REDDY", "LINGAMDINNE");
        Person p3 = new Person(new Long(3), "VENKATA JAYA SAI DEEP KUMAR REDDY", "ANNAPUREDDY");
        Person p4 = new Person(new Long(4), "KRANTHI KUMAR REDDY", "ANNAPUREDDY");

        // Store people in our dataSource list (normally they would come from a database).
        myList = new ArrayList<Person>();
        myList.add(p1);
        myList.add(p2);
        myList.add(p3);
        myList.add(p4);
        
        String dir = request.getRealPath("/");

        // Normally we would provide a pre-compiled .jrxml file
        // or check to make sure we don't compile on every request.
        try {
            JasperCompileManager.compileReportToFile(dir+ "/WEB-INF/classes/jasper/our_jasper_template.jrxml", dir+ "/WEB-INF/classes/jasper/our_compiled_template.jasper");
        } catch (Exception e) {
            e.printStackTrace();
            return ERROR;
        }

        return SUCCESS;
    }

    public List<Person> getMyList() {
        return myList;
    }
}

Person.java



package com.jasper.admin.action;

/**
 * @author KONDA REDDY
 *
 */
public class Person {

    private Long id;

    private String name;

    private String lastName;

    public Person() {
    }

    /**
     * @param name
     * @param lastName
     */
    public Person(String name, String lastName) {
        this.name = name;
        this.lastName = lastName;
    }

    /**
     * @param id
     * @param name
     * @param lastName
     */
    public Person(Long id, String name, String lastName) {
        this.id = id;
        this.name = name;
        this.lastName = lastName;
    }

 /**
  * @return the id
  */
 public Long getId() {
  return id;
 }

 /**
  * @param id the id to set
  */
 public void setId(Long id) {
  this.id = id;
 }

 /**
  * @return the name
  */
 public String getName() {
  return name;
 }

 /**
  * @param name the name to set
  */
 public void setName(String name) {
  this.name = name;
 }

 /**
  * @return the lastName
  */
 public String getLastName() {
  return lastName;
 }

 /**
  * @param lastName the lastName to set
  */
 public void setLastName(String lastName) {
  this.lastName = lastName;
 }

    
}

our_jasper_template.jrxml



<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version last-->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="jasper_test" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" uuid="d22f49ae-9929-44f6-8c5c-ee34a0587e14">
 <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
 <style name="Title" forecolor="#FFFFFF" fontName="Times New Roman" fontSize="50" isBold="false" pdfFontName="Times-Bold"/>
 <field name="name" class="java.lang.String"/>
 <field name="lastName" class="java.lang.String"/>
 <title>
  <band height="65" splitType="Stretch">
   <frame>
    <reportElement uuid="19675ab3-ade7-4b13-b4f8-6af91e4d3bcf" mode="Opaque" x="0" y="0" width="555" height="65" forecolor="#006699" backcolor="#006699"/>
    <staticText>
     <reportElement uuid="19325fe6-91bb-4925-8637-30b76da773cb" style="Title" x="0" y="0" width="555" height="65"/>
     <textElement textAlignment="Right">
      <font size="54" isBold="false"/>
     </textElement>
     <text><![CDATA[Konda Reddy]]></text>
    </staticText>
   </frame>
  </band>
 </title>
 <pageHeader>
  <band splitType="Stretch"/>
 </pageHeader>
 <columnHeader>
  <band height="20" splitType="Stretch">
   <staticText>
    <reportElement uuid="6b8becc8-fd1a-441c-ad9f-e02c1acb220a" x="180" y="0" width="180" height="20"/>
    <textElement>
     <font isUnderline="true"/>
    </textElement>
    <text><![CDATA[NAME]]></text>
   </staticText>
   <staticText>
    <reportElement uuid="5aabd0db-f280-48fa-a018-2e6055e8c701" x="360" y="0" width="180" height="20"/>
    <textElement>
     <font isUnderline="true"/>
    </textElement>
    <text><![CDATA[LASTNAME]]></text>
   </staticText>
  </band>
 </columnHeader>
 <detail>
  <band height="20" splitType="Stretch">
   <textField>
    <reportElement uuid="3265c8f6-f7e5-482d-b555-af4db49f206b" x="180" y="0" width="180" height="15"/>
    <textElement/>
    <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
   </textField>
   <textField>
    <reportElement uuid="57a43440-4996-4ef4-87da-525f76f87da5" x="360" y="0" width="180" height="15"/>
    <textElement/>
    <textFieldExpression><![CDATA[$F{lastName}]]></textFieldExpression>
   </textField>
  </band>
 </detail>
 <columnFooter>
  <band splitType="Stretch"/>
 </columnFooter>
 <pageFooter>
  <band height="15" splitType="Stretch">
   <staticText>
    <reportElement uuid="9c36d27e-b869-41d6-9424-f3900f7626c8" x="0" y="0" width="40" height="15"/>
    <textElement/>
    <text><![CDATA[Page:]]></text>
   </staticText>
   <textField>
    <reportElement uuid="d0ae07db-5f4d-458b-beb2-b49566c42e88" x="40" y="0" width="100" height="15"/>
    <textElement/>
    <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
   </textField>
  </band>
 </pageFooter>
 <summary>
  <band splitType="Stretch"/>
 </summary>
</jasperReport>

web.xml



<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    id="starter"
    version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >

    <display-name>LKREDDY</display-name>

   <filter>
    <filter-name>action2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <!-- END SNIPPET: filter -->
    <filter-mapping>
        <filter-name>action2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    <servlet>
  <servlet-name>ImageServlet</servlet-name>
  <servlet-class>net.sf.jasperreports.j2ee.servlets.ImageServlet</servlet-class>
 </servlet>
 
    <servlet-mapping>
   <servlet-name>ImageServlet</servlet-name>
   <url-pattern>/servlets/image</url-pattern>
 </servlet-mapping>

    <!-- Welcome file lists -->

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>

</web-app>

index.jsp



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
 pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/struts-tags" prefix="s"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<script language="JavaScript">
 function calcHeight() {
  //find the height of the internal page
  var the_height = document.getElementById('the_iframe').contentWindow.document.body.scrollHeight;
  //change the height of the iframe
  document.getElementById('the_iframe').height = the_height;
 }
</script>
<title>Insert title here</title>
</head>
<body>

 <s:url id="jasperList" action="myJasperTest"></s:url>
 <s:a href="%{jasperList}">jasperList</s:a>

 <iframe width="100%" id="the_iframe" onLoad="calcHeight();"
  src="myJasperTest" scrolling="NO" frameborder="0" height="1">  An iframe capable browser is required to view this report. </iframe>
</body>
</html>

Tuesday, 11 December 2012

Sending An e-mail with attachment in my Phonegap Android Application

EmailActivity.java

package com.lkr.androidemail;

import org.apache.cordova.DroidGap;

import android.os.Bundle;

public class EmailActivity extends DroidGap {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");
    }

}

WebIntent.java


package com.borismus.webintent;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;

import org.apache.cordova.DroidGap;
import org.apache.cordova.api.Plugin;
import org.apache.cordova.api.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Environment;
import android.text.Html;
import android.view.View;

/**
 * WebIntent is a PhoneGap plugin that bridges Android intents and web
 * applications:
 * 
 * 1. web apps can spawn intents that call native Android applications. 2.
 * (after setting up correct intent filters for PhoneGap applications), Android
 * intents can be handled by PhoneGap web applications.
 * 
 * @author boris@borismus.com
 * 
 */
public class WebIntent extends Plugin {

    private String onNewIntentCallback = null;

    /**
     * Executes the request and returns PluginResult.
     * 
     * @param action
     *            The action to execute.
     * @param args
     *            JSONArray of arguments for the plugin.
     * @param callbackId
     *            The callback id used when calling back into JavaScript.
     * @return A PluginResult object with a status and message.
     */
    public PluginResult execute(String action, JSONArray args, String callbackId) {
        try {
            if (action.equals("startActivity")) {
                if (args.length() != 1) {
                    return new PluginResult(PluginResult.Status.INVALID_ACTION);
                }

                // Parse the arguments
                JSONObject obj = args.getJSONObject(0);
                String type = obj.has("type") ? obj.getString("type") : null;
                Uri uri = obj.has("url") ? Uri.parse(obj.getString("url")) : null;
                JSONObject extras = obj.has("extras") ? obj.getJSONObject("extras") : null;
                Map<String, String> extrasMap = new HashMap<String, String>();

                // Populate the extras if any exist
                if (extras != null) {
                    JSONArray extraNames = extras.names();
                    for (int i = 0; i < extraNames.length(); i++) {
                        String key = extraNames.getString(i);
                        String value = extras.getString(key);
                        extrasMap.put(key, value);
                    }
                }

                startActivity(obj.getString("action"), uri, type, extrasMap);
                return new PluginResult(PluginResult.Status.OK);

            } else if (action.equals("hasExtra")) {
                if (args.length() != 1) {
                    return new PluginResult(PluginResult.Status.INVALID_ACTION);
                }
                Intent i = ((DroidGap)this.cordova.getContext()).getIntent();
                String extraName = args.getString(0);
                return new PluginResult(PluginResult.Status.OK, i.hasExtra(extraName));

            } else if (action.equals("getExtra")) {
                if (args.length() != 1) {
                    return new PluginResult(PluginResult.Status.INVALID_ACTION);
                }
                Intent i = ((DroidGap)this.cordova.getContext()).getIntent();
                String extraName = args.getString(0);
                if (i.hasExtra(extraName)) {
                    return new PluginResult(PluginResult.Status.OK, i.getStringExtra(extraName));
                } else {
                    return new PluginResult(PluginResult.Status.ERROR);
                }
            } else if (action.equals("getUri")) {
                if (args.length() != 0) {
                    return new PluginResult(PluginResult.Status.INVALID_ACTION);
                }

                Intent i = ((DroidGap)this.cordova.getContext()).getIntent();
                String uri = i.getDataString();
                return new PluginResult(PluginResult.Status.OK, uri);
            } else if (action.equals("onNewIntent")) {
                if (args.length() != 0) {
                    return new PluginResult(PluginResult.Status.INVALID_ACTION);
                }

                this.onNewIntentCallback = callbackId;
                PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
                result.setKeepCallback(true);
                return result;
            } else if (action.equals("sendBroadcast")) 
            {
                if (args.length() != 1) {
                    return new PluginResult(PluginResult.Status.INVALID_ACTION);
                }

                // Parse the arguments
                JSONObject obj = args.getJSONObject(0);

                JSONObject extras = obj.has("extras") ? obj.getJSONObject("extras") : null;
                Map<String, String> extrasMap = new HashMap<String, String>();

                // Populate the extras if any exist
                if (extras != null) {
                    JSONArray extraNames = extras.names();
                    for (int i = 0; i < extraNames.length(); i++) {
                        String key = extraNames.getString(i);
                        String value = extras.getString(key);
                        extrasMap.put(key, value);
                    }
                }

                sendBroadcast(obj.getString("action"), extrasMap);
                return new PluginResult(PluginResult.Status.OK);
            }
            return new PluginResult(PluginResult.Status.INVALID_ACTION);
        } catch (JSONException e) {
            e.printStackTrace();
            return new PluginResult(PluginResult.Status.JSON_EXCEPTION);
        }
    }

    @Override
    public void onNewIntent(Intent intent) {
        if (this.onNewIntentCallback != null) {
            PluginResult result = new PluginResult(PluginResult.Status.OK, intent.getDataString());
            result.setKeepCallback(true);
            this.success(result, this.onNewIntentCallback);
        }
    }

    void startActivity(String action, Uri uri, String type, Map<String, String> extras) {
        Intent i = (uri != null ? new Intent(action, uri) : new Intent(action));
        
        if (type != null && uri != null) {
            i.setDataAndType(uri, type); //Fix the crash problem with android 2.3.6
        } else {
            if (type != null) {
                i.setType(type);
            }
        }
        
        for (String key : extras.keySet()) {
            String value = extras.get(key);
            // If type is text html, the extra text must sent as HTML
            if (key.equals(Intent.EXTRA_TEXT) && type.equals("text/html")) {
                i.putExtra(key, Html.fromHtml(value));
            } else if (key.equals(Intent.EXTRA_STREAM)) {
             // image naming and path  to include sd card
                String mPath = Environment.getExternalStorageDirectory().toString() + "/abc.png";   

                // create bitmap screen capture
                Bitmap bitmap;
                View v1 = this.ctx.getActivity().getCurrentFocus();
                v1.setDrawingCacheEnabled(true);
                bitmap = Bitmap.createBitmap(v1.getDrawingCache());
                v1.setDrawingCacheEnabled(false);

                OutputStream fout = null;
                File imageFile = new File(mPath);

                try {
                    fout = new FileOutputStream(imageFile);
                    bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fout);
                    fout.flush();
                    fout.close();

                } catch (FileNotFoundException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
             
                // allowes sharing of images as attachments.
                // value in this case should be a URI of a file
                
                System.out.println("image path is:"+mPath);
             System.out.println("streammmmmmm:"+Intent.EXTRA_STREAM);
                i.putExtra(key, Uri.parse(value));
            } else if (key.equals(Intent.EXTRA_EMAIL)) {
                // allows to add the email address of the receiver
                i.putExtra(Intent.EXTRA_EMAIL, new String[] { value });
            } else {
                i.putExtra(key, value);
            }
        }
        this.cordova.getActivity().startActivity(i);
    }

    void sendBroadcast(String action, Map<String, String> extras) {
        Intent intent = new Intent();
        intent.setAction(action);
        for (String key : extras.keySet()) {
            String value = extras.get(key);
            intent.putExtra(key, value);
        }

        ((DroidGap)this.cordova.getContext()).sendBroadcast(intent);
    }
}

index.html


<!DOCTYPE HTML>
<html>
<head>
<title>Cordova</title>

<script src="cordova-2.0.0.js"></script>
<script src="webintent.js"></script>


 <script>

function gomail(){
 alert("mail going");
 var extras = {};
   extras[WebIntent.EXTRA_SUBJECT] = "subject";
   extras[WebIntent.EXTRA_TEXT] = "body";
   extras[WebIntent.EXTRA_STREAM]="file:///mnt/sdcard/abc.png";
   WebIntent.prototype.startActivity({ 
       action: WebIntent.ACTION_SEND,
       type: 'application/octet-stream', 
       extras: extras 
     }, 
     function() {
      alert("success");
     }, 
     function() {
       alert('Failed to send email via Android Intent');
     }
   ); 
}
</script>
 

</head>
<body>
  
   <div>
  
   <h1>Email sending</h1>

<a href="#" onclick="gomail();">emailll</a>
  
 </div>   
  
 
</body>
</html>

webintent.js


/**
 * cordova Web Intent plugin
 * Copyright (c) Boris Smus 2010
 *
 */
var WebIntent = function() { 

};

WebIntent.ACTION_SEND = "android.intent.action.SEND";
WebIntent.ACTION_VIEW= "android.intent.action.VIEW";
WebIntent.EXTRA_TEXT = "android.intent.extra.TEXT";
WebIntent.EXTRA_SUBJECT = "android.intent.extra.SUBJECT";
WebIntent.EXTRA_STREAM = "android.intent.extra.STREAM";
WebIntent.EXTRA_EMAIL = "android.intent.extra.EMAIL";

WebIntent.prototype.startActivity = function(params, success, fail) {
 alert("webintent");
 return cordova.exec(function(args) {
        success(args);
    }, function(args) {
        fail(args);
    }, 'WebIntent', 'startActivity', [params]);
};

WebIntent.prototype.hasExtra = function(params, success, fail) {
 return cordova.exec(function(args) {
        success(args);
    }, function(args) {
        fail(args);
    }, 'WebIntent', 'hasExtra', [params]);
};

WebIntent.prototype.getUri = function(success, fail) {
 return cordova.exec(function(args) {
        success(args);
    }, function(args) {
        fail(args);
    }, 'WebIntent', 'getUri', []);
};

WebIntent.prototype.getExtra = function(params, success, fail) {
 return cordova.exec(function(args) {
        success(args);
    }, function(args) {
        fail(args);
    }, 'WebIntent', 'getExtra', [params]);
};


WebIntent.prototype.onNewIntent = function(callback) {
 return cordova.exec(function(args) {
  callback(args);
    }, function(args) {
    }, 'WebIntent', 'onNewIntent', []);
};

WebIntent.prototype.sendBroadcast = function(params, success, fail) {
    return cordova.exec(function(args) {
        success(args);
    }, function(args) {
        fail(args);
    }, 'WebIntent', 'sendBroadcast', [params]);
};

cordova.addConstructor(function() {
 window.webintent = new WebIntent();
 
 // backwards compatibility 
 window.plugins = window.plugins || {};
 window.plugins.webintent = window.webintent;
});

config.xml


<?xml version="1.0" encoding="utf-8"?>
<!--
       Licensed to the Apache Software Foundation (ASF) under one
       or more contributor license agreements.  See the NOTICE file
       distributed with this work for additional information
       regarding copyright ownership.  The ASF licenses this file
       to you under the Apache License, Version 2.0 (the
       "License"); you may not use this file except in compliance
       with the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing,
       software distributed under the License is distributed on an
       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
       KIND, either express or implied.  See the License for the
       specific language governing permissions and limitations
       under the License.
-->
<cordova>
    <!--
    access elements control the Android whitelist.
    Domains are assumed blocked unless set otherwise
     -->

    <access origin="http://127.0.0.1*"/> <!-- allow local pages -->

    <!-- <access origin="https://example.com" /> allow any secure requests to example.com -->
    <!-- <access origin="https://example.com" subdomains="true" /> such as above, but including subdomains, such as www -->
    <!-- <access origin=".*"/> Allow all domains, suggested development use only -->

    <log level="DEBUG"/>
    <preference name="useBrowserHistory" value="false" />
<plugins>
    <plugin name="App" value="org.apache.cordova.App"/>
    <plugin name="Geolocation" value="org.apache.cordova.GeoBroker"/>
    <plugin name="Device" value="org.apache.cordova.Device"/>
    <plugin name="Accelerometer" value="org.apache.cordova.AccelListener"/>
    <plugin name="Compass" value="org.apache.cordova.CompassListener"/>
    <plugin name="Media" value="org.apache.cordova.AudioHandler"/>
    <plugin name="Camera" value="org.apache.cordova.CameraLauncher"/>
    <plugin name="Contacts" value="org.apache.cordova.ContactManager"/>
    <plugin name="File" value="org.apache.cordova.FileUtils"/>
    <plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>
    <plugin name="Notification" value="org.apache.cordova.Notification"/>
    <plugin name="Storage" value="org.apache.cordova.Storage"/>
    <plugin name="Temperature" value="org.apache.cordova.TempListener"/>
    <plugin name="FileTransfer" value="org.apache.cordova.FileTransfer"/>
    <plugin name="Capture" value="org.apache.cordova.Capture"/>
    <plugin name="Battery" value="org.apache.cordova.BatteryListener"/>
    <plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
    <plugin name="WebIntent" value="com.borismus.webintent.WebIntent"/>
</plugins>
</cordova>

AndroidManifest.xml



<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.lkr.androidemail"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:resizeable="true"
        android:smallScreens="true" />

    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="android.permission.BROADCAST_STICKY" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".EmailActivity"
            android:label="@string/title_activity_email" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
                
                
                
            </intent-filter>
        </activity>
    </application>

</manifest>