Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use the Note To Self intent from Google Now?

Tags:

android

gmail

I know its not best practice, but i want to use thr Note To Self intent to send an email in the background. I found an AUTO_SEND intent that Keep uses, but I can't seem to open Gmail or Keep with it - they don't show in the activity picker, only Evermore and Notif do.

Here's what I'm currently trying:

    Intent mailClient = new Intent("com.google.android.gm.action.AUTO_SEND");
    mailClient.setClassName("com.google.android.gm", "com.google.android.gm.AutoSendActivity");
    startActivity(mailClient);

However, I'm still getting an error -

04-12 15:06:28.393: W/ActivityManager(443): Permission Denial: starting Intent { act=com.google.android.gm.action.AUTO_SEND cmp=com.google.android.gm/.AutoSendActivity } from ProcessRecord{41adee50 11298:com.email_to_self/u0a10113} (pid=11298, uid=10113) requires com.google.android.gm.permission.AUTO_SEND

I added the permission into my manifest by doing

<uses-permission android:name="com.google.android.gm.permission.AUTO_SEND"> 

But the problem persists. Any ideas?

like image 435
Foxh8er Avatar asked Jan 30 '26 20:01

Foxh8er


1 Answers

You can't.

This action is handled by this activity and requires permission com.google.android.gm.permission.AUTO_SEND

    <activity android:name="com.google.android.gm.AutoSendActivity"
              ...
              android:permission="com.google.android.gm.permission.AUTO_SEND">

        <intent-filter android:label="@string/app_name">
            <action android:name="com.google.android.gm.action.AUTO_SEND" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="*/*" />
        </intent-filter>
    </activity>

This permission is defined in Gmail's manifest, and it's a limited to Google's applications (or more precisely signed with the same key as Gmail).

<permission android:name="com.google.android.gm.permission.AUTO_SEND"
            android:permissionGroup="android.permission-group.MESSAGES"
            android:protectionLevel="signature" android:label="@string/auto_send_perm_label"
            android:description="@string/auto_send_perm_desc"/>
like image 187
rds Avatar answered Feb 01 '26 14:02

rds



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!