I'm looking for a way to start a videocall from my Android app written in Delphi 10.3. For that I want to use Android intents to 3rd-party app (WhatsApp or Skype).
Here's what I have already tried. I'm using 123
as contacts id, expecting that even if it is not a valid id, WhatsApp should still open and warn about that:
Based on https://stackoverflow.com/a/38674897 - nothing happens
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
Intent.setData(StrToJURI('content://com.android.contacts/data/123'));
Intent.setType(StringToJString('vnd.android.cursor.item/vnd.com.whatsapp.voip.call'));
Based on https://stackoverflow.com/a/46049004 - nothing happens
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
Intent.setData(StrToJURI('content://com.android.contacts/data/123'));
Intent.setType(StringToJString('vnd.android.cursor.item/vnd.com.whatsapp.video.call'));
Intent.setPackage(StringToJString('com.whatsapp'));
Fix suggests to disuse SetType https://stackoverflow.com/a/28244207 - nothing happens
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
Intent.setDataAndType(
StrToJURI('content://com.android.contacts/data/123'),
StringToJString('vnd.android.cursor.item/vnd.com.whatsapp.video.call'));
Intent.setPackage(StringToJString('com.whatsapp'));
Skype code sample based on https://stackoverflow.com/a/14294299 - it opens Skype, but does not open chat/call on first try. If I switch to my app while Skype is open in background, on a second try it will start videocall.
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_VIEW);
//Intent.setData(StrToJURI('skype:username?call&video=true'));
Intent.setData(StrToJURI('skype:username'));
Trying videocall
action - pops up a message "Receiver not found"
Intent := TJIntent.Create;
Intent.setAction(StringToJString('com.android.phone.videocall'));
Intent.setData(StrToJURI('skype:username'));
Intent := TJIntent.Create;
Intent.setAction(StringToJString('com.android.phone.videocall'));
Intent.setData(StrToJURI('tel:123456789'));
All intents are executed with:
if MainActivity.getPackageManager.queryIntentActivities(Intent, TJPackageManager.JavaClass.MATCH_DEFAULT_ONLY).size > 0 then
MainActivity.startActivity(Intent)
else
ShowMessage('Receiver not found');
How do I make a videocall from Android App written in Delphi?