Re: [android-developers] opening Android Email application from another application

2010-10-06 Thread Mark Murphy
On Wed, Oct 6, 2010 at 3:29 PM, Priyank Maiya  wrote:
> Thanks for your reply. What you said worked. Instead of querying the email
> provider, I directly called the intent:
>
> emailIntent.setClassName("com.android.email",
> "com.android.email.activity.Welcome");
> startActivity(emailIntent);
>
> But my doubt is that, I dont know whether the user has configured his email
> or not.

That is only one possible problem. Others:

-- this app may not be installed
-- this app may be modified by the core Android team
-- this app may be modified by device manufacturers
-- this app may be replaced by device manufacturers
-- this app may not be the one the user is using

> Is there any other way of doing this ?

Use ACTION_SEND with EXTRA_STREAM.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 3.0.1 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] opening Android Email application from another application

2010-10-06 Thread Kumar Bibek
You should not be using class names like that. It is advised to use the
Intent Mechanism only. If the user hasn't configured the mail account, it's
the responsibility of the mail app to open the proper activity.

On Thu, Oct 7, 2010 at 12:59 AM, Priyank Maiya wrote:

> Hi,
> Thanks for your reply. What you said worked. Instead of querying the email
> provider, I directly called the intent:
>
> emailIntent.setClassName("com.android.email",
> "com.android.email.activity.Welcome");
> startActivity(emailIntent);
>
> But my doubt is that, I dont know whether the user has configured his email
> or not.
> i.e whether to call the Welcome activity or MessageCompose activity of the
> email application.
> Because of this, I thought of querying the email app and if there is an
> account, I will start the MessageCompose  activity.
>
> Is there any other way of doing this ?
>
> Thanks again. your suggestion really helped.
>
> Priyank
>
> On Wed, Oct 6, 2010 at 1:43 PM, Kumar Bibek  wrote:
>
>> You can open the Activity(Compose) of the mail app. But the content
>> provider for the gmail app is not public. So, you cannot query that content
>> provider.
>>
>> If you want to send an audio file as an attachement, checkout the SEND
>> action.
>>
>> http://developer.android.com/reference/android/content/Intent.html#ACTION_SEND
>>
>>
>> On Thu, Oct 7, 2010 at 12:09 AM, Priyank  wrote:
>>
>>> Hi,
>>>
>>> I have my application which creates an audio file. I need to forward
>>> this file via Android Email app. But on calling the email intent, I
>>> get a permission denial.
>>>
>>> I am calling the email app like this:
>>>Uri  emailUri =
>>> Uri.parse("content://com.android.email.provider/
>>> account");
>>>Cursor cursor = mCr.query(emailUri, null, null, null,
>>> null);
>>>
>>> I get an exception :
>>> java.lang.SecurityException: Permission Denial: reading
>>> com.android.email.provider.EmailProvider uri
>>> content://com.android.email.provider/account
>>> from pid=1721, uid=10031 requires
>>> com.android.email.permission.ACCESS_PROVIDER
>>>
>>> I have set the email permission in my Manifest file:
>>> >> android:name="com.android.email.permission.ACCESS_PROVIDER">>> permission>
>>>
>>> When I am launching the app, I get this "Not granting access" message
>>> in the ddms logs:
>>> WARN/PackageManager(90): Not granting permission
>>> com.android.email.permission.ACCESS_PROVIDER to package
>>> com.mplayer.application (protectionLevel=3 flags=0xbe44)
>>>
>>> Can I not open the android email app from my application.
>>> I am working on Android 2.2
>>>
>>> Thanks,
>>> Priyank
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-developers@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> android-developers+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>>
>>
>>
>>
>> --
>> Kumar Bibek
>> http://techdroid.kbeanie.com
>> http://www.kbeanie.com
>>
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] opening Android Email application from another application

2010-10-06 Thread Priyank Maiya
Hi,
Thanks for your reply. What you said worked. Instead of querying the email
provider, I directly called the intent:

emailIntent.setClassName("com.android.email",
"com.android.email.activity.Welcome");
startActivity(emailIntent);

But my doubt is that, I dont know whether the user has configured his email
or not.
i.e whether to call the Welcome activity or MessageCompose activity of the
email application.
Because of this, I thought of querying the email app and if there is an
account, I will start the MessageCompose  activity.

Is there any other way of doing this ?

Thanks again. your suggestion really helped.

Priyank

On Wed, Oct 6, 2010 at 1:43 PM, Kumar Bibek  wrote:

> You can open the Activity(Compose) of the mail app. But the content
> provider for the gmail app is not public. So, you cannot query that content
> provider.
>
> If you want to send an audio file as an attachement, checkout the SEND
> action.
>
> http://developer.android.com/reference/android/content/Intent.html#ACTION_SEND
>
>
> On Thu, Oct 7, 2010 at 12:09 AM, Priyank  wrote:
>
>> Hi,
>>
>> I have my application which creates an audio file. I need to forward
>> this file via Android Email app. But on calling the email intent, I
>> get a permission denial.
>>
>> I am calling the email app like this:
>>Uri  emailUri =
>> Uri.parse("content://com.android.email.provider/
>> account");
>>Cursor cursor = mCr.query(emailUri, null, null, null,
>> null);
>>
>> I get an exception :
>> java.lang.SecurityException: Permission Denial: reading
>> com.android.email.provider.EmailProvider uri
>> content://com.android.email.provider/account
>> from pid=1721, uid=10031 requires
>> com.android.email.permission.ACCESS_PROVIDER
>>
>> I have set the email permission in my Manifest file:
>> > android:name="com.android.email.permission.ACCESS_PROVIDER">> permission>
>>
>> When I am launching the app, I get this "Not granting access" message
>> in the ddms logs:
>> WARN/PackageManager(90): Not granting permission
>> com.android.email.permission.ACCESS_PROVIDER to package
>> com.mplayer.application (protectionLevel=3 flags=0xbe44)
>>
>> Can I not open the android email app from my application.
>> I am working on Android 2.2
>>
>> Thanks,
>> Priyank
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>
>
> --
> Kumar Bibek
> http://techdroid.kbeanie.com
> http://www.kbeanie.com
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] opening Android Email application from another application

2010-10-06 Thread Kumar Bibek
You can open the Activity(Compose) of the mail app. But the content provider
for the gmail app is not public. So, you cannot query that content provider.

If you want to send an audio file as an attachement, checkout the SEND
action.
http://developer.android.com/reference/android/content/Intent.html#ACTION_SEND

On Thu, Oct 7, 2010 at 12:09 AM, Priyank  wrote:

> Hi,
>
> I have my application which creates an audio file. I need to forward
> this file via Android Email app. But on calling the email intent, I
> get a permission denial.
>
> I am calling the email app like this:
>Uri  emailUri =
> Uri.parse("content://com.android.email.provider/
> account");
>Cursor cursor = mCr.query(emailUri, null, null, null, null);
>
> I get an exception :
> java.lang.SecurityException: Permission Denial: reading
> com.android.email.provider.EmailProvider uri
> content://com.android.email.provider/account
> from pid=1721, uid=10031 requires
> com.android.email.permission.ACCESS_PROVIDER
>
> I have set the email permission in my Manifest file:
>  android:name="com.android.email.permission.ACCESS_PROVIDER"> permission>
>
> When I am launching the app, I get this "Not granting access" message
> in the ddms logs:
> WARN/PackageManager(90): Not granting permission
> com.android.email.permission.ACCESS_PROVIDER to package
> com.mplayer.application (protectionLevel=3 flags=0xbe44)
>
> Can I not open the android email app from my application.
> I am working on Android 2.2
>
> Thanks,
> Priyank
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 
Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en