It might be possible, but google has made sure it will be impossible.
I spent a couple of hours trying to make it work:
- Pulled the Gmail.apk from my rooted phone.
- Decompiled it using apktools.
- Went over the manifest.xml
2 Activities seem to be useful for it:
activity android:theme="@android:style/Theme.Light.NoTitleBar"
android:label="@string/activity_conversation"
android:name="HtmlConversationActivity"
android:configChanges="keyboardHidden|orientation"
and
activity android:label="@string/activity_search" android:name="SearchActivity"
Both of them have no intent filters so you can't call them.
If you try you will get
Permission Denial: starting Intent { act=android.intent.action.VIEW flg=0x10000000 cmp=com.google.android.gm/.HtmlConversationActivity } from ProcessRecord{40b7d248 26043:co.il.gmailresearch/10154} (pid=26043, uid=10154) requires null
It might be possible using the com.google.android.gm.ConversationListActivity.
But the code must be obfuscated and I didn't bother to get the source code of the Gmail.apk to verify which flags they use...
EDIT:
Well OK I did bother to check it, and surprising enough Google did not obfuscate their Gmail app :)
So I was able to get the source code of the APK.
Did some digging and this is what I found...
The relevant Activity is ConverstaionListActivity.
In the Manifest.xml it has this intent filter:
action android:name="android.intent.action.SEARCH"/>
As i inspected the code for the activity I found out that there are 3 expected string to get as extra:
public static final String EXTRA_LABEL = "label";
public static final String EXTRA_SEARCH = "search";
public static final String EXTRA_TITLE = "title";
Anyways. button line, you can't open a specific conversation. but you can pass a search query that will display only your specific conversation from all the mails the user has.
Intent mailClient = new Intent(Intent.ACTION_SEARCH);
mailClient.setClassName("com.google.android.gm", "com.google.android.gm.ConversationListActivity");
mailClient.putExtra("query", "15 Apps for Programming");
startActivity(mailClient);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…