簡體   English   中英

如何使用Google即時自我意圖?

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

我知道這不是最好的做法,但我想使用thr Note To Self意圖在后台發送電子郵件。 我找到了Keep使用的AUTO_SEND意圖,但我似乎無法打開Gmail或保持使用它 - 它們不顯示在活動選擇器中,只有Evermore和Notif這樣做。

這是我目前正在嘗試的內容:

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

但是,我仍然收到錯誤 -

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

我通過這樣做將權限添加到我的清單中

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

但問題仍然存在。 有任何想法嗎?

你不能。

此操作由此活動處理,需要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>

此權限在Gmail的清單中定義,並且僅限於Google的應用程序(或者更准確地使用與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"/>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM