In the stock Contacts, Messaging, and Phone apps, there is a button that allows users to use audio and video calling via Google Duo. I would like this functionality in my app.
Currently, I am only able to reach the main page of Google Duo, each Intent is showing some error in the Logcat that I believe is preventing me from reaching the calling function through.
I've run some tests and created an Intent with Package =
- "com.google.android.apps.tachyon"
I then created a PackageManager and iterated over the ResolveInfo found from the pm.queryIntentActivities() function. This returned some interesting results being that I could request the following, explicitly named packages.
Packages Found :
com.google.android.apps.tachyon.ContactsAudioActionActivity
com.google.android.apps.tachyon.ContactsAudioActionActivity2
com.google.android.apps.tachyon.ContactsVideoActionActivity
com.google.android.apps.tachyon.ContactsVideoActionActivity2
I've Also done some logcat searching and found these two '''Intent types''' being checked.
Types Found:
vnd.android.cursor.item/com.google.android.apps.tachyon.phone.audio
vnd.android.cursor.item/com.google.android.apps.tachyon.phone
Upon further testing, I've found that the latter .phone type is for the Video packages and the .phone.audio type is for the Audio packages... So I ran even more tests...
Results:
Packages: .ContactsAudioActionActivity2 and
.ContactsVideoActionActivity2 require a permission, CALL_PRIVILEDGED
that is only given to system apps. This is not a system app. These are
the packages the stock Contacts, Phone, and Messaging apps use
Packages: .ContactsAudioActionActivity and .ContactsVideoActionActivity
leaves me at the main screen of Google Duo no matter the data I pass.
More on that in a bit.
I ended up with this Intent format, with the presumed issue being the Data I am setting.
private void openGoogleDuo(){
// Leaves Log Error "executeCallFromContactsApps: result doesn't contain a number" (I checked the _ids and everything)
Uri data1 = Uri.parse("content://com.android.contacts/data/1234");
// Leaves Log Error "External start call intent missing data (e.g. "content://com.android.contacts/data/123").
Uri data0 = Uri.parse("content://phone/5135554235");
Uri data2 = Uri.parse("tel: +15135553245");
Uri data3 = Uri.parse("tel: 5133455513");
// ALL DATA OPENS THE APP, BUT NO CALL...
String audioCallType = "vnd.android.cursor.item/com.google.android.apps.tachyon.phone.audio";
String videoCallType = "vnd.android.cursor.item/com.google.android.apps.tachyon.phone";
String mainGoogleDuoPackage = "com.google.android.apps.tachyon";
String videoCallPackage = "com.google.android.apps.tachyon.ContactsVideoActionActivity"; // CALL_PRIVILEGE locked package appends '2'
String audioCallPackage = "com.google.android.apps.tachyon.ContactsAudioActionActivity"; // CALL_PRIVILEGE locked package appends '2'
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(data1 , audioCallType);
intent.setComponent(new ComponentName(mainGoogleDuoPackage, audioCallPackage));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage(audioCallPackage);
startActivity(intent);
}
Expected results are to instantly invoke the audio or video call to the specified contact/phone number in Google Duo without any further user input.
This code is leaving me at the main screen of Google Duo.
Any help would be honorable.