Reputation: 55
I am trying to make a video call from my application to skype in android but when video call is ended, i need to return to my avtivity which starts the intent. How to achieve this?
I tried this
public class MainActivity extends AppCompatActivity {
private Button btnSkypeCall;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSkypeCall = (Button) findViewById(R.id.btnCallSkype);
btnSkypeCall.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(isSkypeClientInstalled(MainActivity.this)){
Uri skypeUri = Uri.parse("skype:username?call&video=true");
Intent myIntent = new Intent(Intent.ACTION_VIEW, skypeUri);
// Restrict the Intent to being handled by the Skype for Android client only.
myIntent.setComponent(new ComponentName("com.skype.raider", "com.skype.raider.Main"));
myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Initiate the Intent. It should never fail because you've already established the
// presence of its handler (although there is an extremely minute window where that
// handler can go away).
startActivity(myIntent);
}
else{
Toast.makeText(getApplicationContext(), "Skype is not found!", Toast.LENGTH_LONG).show();
}
}
});
}
public boolean isSkypeClientInstalled(Context myContext) {
PackageManager myPackageMgr = myContext.getPackageManager();
try {
myPackageMgr.getPackageInfo("com.skype.raider", PackageManager.GET_ACTIVITIES);
}
catch (PackageManager.NameNotFoundException e) {
return (false);
}
return (true);
}
}
But i didnt find anything to return my application.
Upvotes: 0
Views: 526
Reputation: 13932
The Skype integration is very poor on Android and it appears the only supported operations are passing the Uri to parse from your app to the skype application...
try just using startActivityForResult(myIntent, 0);
this should get you back into the application after going out to skype (sometimes this is one back press sometimes two), however it appears that the onActivityResult method is actually being invoked prior to launching the application itself so there is no good way to handle anything coming back into your application.
Upvotes: 1