38716

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

Question:

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?

Answer1:

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"/>

Recommend

  • How can we take like an input the keyboard in JS?
  • Julia pmap speed - parallel processing - dynamic programming
  • Java Server/Client string delay
  • Node.js find blob on image using connected components
  • How to replace at the particular range of indexes?
  • SQL Server 2008: Joining results of STORED PROCEDURE (dynamic columns) with results of a SELECT stat
  • ms vc++ compiler optimizating away erroneous code
  • What does the type parameter in the method definition mean? [duplicate]
  • EF4 Unknown Column In Field List
  • How to open default message app in my android application?
  • GraphicsMagick replace all colors (except yellow) to transparent
  • Service not starting on Oreo in app widget using PendingIntent
  • Swift - UICollectionView repeats (duplicate) cells
  • Node.js: Error: spawn ENOENT while using GM module
  • How can I use the Note To Self intent from Google Now?
  • Reading an image into an array?
  • Android TextView, setText using multiple variables concated together
  • Why would /Qvec-report:2 return nothing ? (MSVC 2012)
  • Binding KnockoutJS to Google Maps InfoWindow content
  • Regex for country code
  • Javascript regex. Need to extract value from a SVG string
  • Regex: get every number that doesn't has an other number before or after itself
  • Intent Filter for handling address press in Contact?
  • Unity Android with AppCompat Rejecting re-init on previously-failed class java.lang.Class
  • Android NFC: can we use intent filter with mime type? (android 2.3.3)
  • iOS Validation failed -> Bundle is invalid (Xcode 6.2, iOS 8.2)
  • Send data from edittext to listview
  • Splash Screen will not display
  • How can go in last activity with resume button?
  • Bootstrap (v3.3.4) glyphicons not displayed in IE when refresh page (F5)
  • Implementing “partial void” in VB
  • Sending HTML Form Data to Spring REST Web Service
  • Android Google Maps API v2 start navigation
  • Dialing with Intent.ACTION_CALL stopps at # in phone number
  • what is the difference between the asp.net mvc application and asp.net web application
  • Is there a mandatory requirement to switch app.yaml?
  • Hits per day in Google Big Query
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Linking SubReports Without LinkChild/LinkMaster
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass