How do I make my Android app appear in the app when you send WhatsApp chat emails?

I’m interested in my application being displayed in the list of applications displayed when using the "Email Communication" feature in WhatsApp.

When registering my phone when using the WhatsApp Send Email function, I see that Gmail has the intention of SEND_MULTIPLE :

 I/ActivityManager( 859): START u0 {act=android.intent.action.SEND_MULTIPLE typ=text/* flg=0xb080001 pkg=com.google.android.gm cmp=com.google.android.gm/.ComposeActivityGmail (has clip) (has extras)} from uid 10114 on display 0 

So, I have to add an intent filter for the SEND_MULTIPLE action in the manifest of my application.

Currently my AndroidManifest.xml :

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="co.xxx.xxx" > <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme" > <activity android:name=".MyActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.SENDTO" /> <data android:scheme="mailto" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <data android:scheme="mailto" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.SEND_MULTIPLE" /> <data android:mimeType="*/*" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.SEND" /> <data android:mimeType="*/*" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> </manifest> 

However, when I launch my application on my phone through Android Studio, it does not appear when I try to export my WhatsApp session. Conversely, it appears in the application of choice when trying to share a photo of my gallery.

What am I missing in AndroidManifest, which prevents my app from showing when sending messages about my WhatsApp conversations? Is there anything else I need to declare the OS to make my application available for appearing in the application?

I tried to install K-9 Mail . After installing it, it does not appear in the application of choice when sending chat messages via WhatsApp, but after setting up an account in K-9 it appears in the editor. Is it possible that K9 announces to the OS that it is ready to send emails?

Thanks!

+6
source share
1 answer

Unfortunately, even if your manifest is configured correctly, you cannot see your application in the application of choice when sending chat emails, because your application must be on the WhatsApp white list. Only the selected package names will be available in the WhatsApp application.

For example, we have an application with the package name com.example.whatsappemailchat . AndroidManifest.xml looks something like this:

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.whatsappemailchat" > <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme" > <activity android:name="com.example.whatsappemailchat.MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.SENDTO"/> <data android:scheme="mailto"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.SEND"/> <data android:mimeType="*/*"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.SEND_MULTIPLE"/> <data android:mimeType="*/*"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW"/> <data android:scheme="mailto"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> </intent-filter> </activity> </application> </manifest> 

and this is build.gradle :

 apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.example.whatsappemailchat" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } 

Everything is configured correctly, we launch our application, but if we select More > Email chat , our application will not appear.

Now change applicationId to com.google.android.gm.test (Gmail plus .test package name as a suffix to avoid collision with real Gmail) in our build.gradle :

 apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.google.android.gm.test" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } 

Now launch our application, open WhatsApp, select a chat, select More > Email chat and magically our application will be in the application of choice, as you can see in this screenshot:

enter image description here

I can confirm that these package names are marked with WhatsApp:

  • com.google.android.gm
  • com.fsck.k9
  • com.boxer.email
  • com.google.android.email

I think the only viable solution is to try contacting WhatsApp and ask if it is possible to whitelist the name of your package.

+12
source

All Articles