我知道它不是最佳做法,但我想使用thr Note To Self在後臺發送電子郵件。我發現了Keep使用的AUTO_SEND意圖,但似乎無法打開Gmail或保留它 - 它們不會顯示在活動選擇器中,只有Evermore和Notif纔會顯示。如何從Google Now使用「注意到自我意圖」?
這裏就是我目前想:
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">
但問題依然存在。有任何想法嗎?
也許你不能擁有該權限 - 它可能是'簽名'權限,要求你的應用程序使用與其他應用程序相同的簽名密鑰進行簽名。 – CommonsWare
我怎樣才能確定它是或不是? – Foxh8er