Android : Launch Skype to be in background - android

I hope this is just a temporary problem and Skype allows an autostart feature.
I need to launch Skype so that it can receive Skype calls and video calls, and then launch my app. I work with the elderly s simplicity is at a premium. My app runs continuously.
The following code seems to achieve this goal in a BOOT BroadcastReceiver.
PackageManager pmi = context.getPackageManager();
String packageName ="com.skype.raider";
context.startActivity(pmi.getLaunchIntentForPackage(packageName));
Log.d("ANDRO_ASYNC",String.format("should launch Skype"));
Intent intent1 = new Intent(context,MyApp.class);
intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent1.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Bundle bundle = new Bundle();
bundle.putInt("FromBoot",1);
intent1.putExtras(bundle);
try{ // hoping to schedule the start to after Skype has finished
Thread.sleep(20000);
}catch(InterruptedException ex){
Log.d("ANDRO_ASYNC",String.format("error in delay loop"));
}
context.startActivity(intent1);
This launches Skype and waits 20s to get sorted out before launching my app. My app ends up on the screen (desired effect).
However, it has a tiny problem for most people, but a big one for me. After the first Skype call the Blue welcome screen of Skype stays up, and the user has to press back button. Effectively this makes ending a Skype call different depending on whether it is the first or subsequent calls.
Questions.
Can I close Skype from my app?
Can I detect that Skype is finished teh call from my app?

Related

How to Start Activity From Service Android Q

Hi Developers I hope All are You fine. I need help. I make a AppLocker app and I use service to check which app i currently running. i locked app in my database with package name. When I show my lock screen From Service my Intent hit but lockScreen not Showing.How i call Activity From Service below is my Codeto start Activty from Service
if (locker_list!=null) {
if (launchapp) {
Log.d("TAG", "run: lock Screen Show");
Intent intent = new Intent(mContext, Lock_app_screen.class);
intent.putExtra("package_name", current_app);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
}
}
Android 10 (API level 29) and higher place restrictions on when apps can start activities when the app is running in the background. These restrictions help minimize interruptions for the user and keep the user more in control of what's shown on their screen.
for more...
see this

Double Intent for call skype/phone

Hi I want with the press of the button to either call a phone number or make a Skype call.
To make the call I use:
Intent phone= new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "+30 6********7"));
startActivity(phone);
Which pops a Window and let me choose from phone app or Skype. When I choose Skype it tries to make a call with Skype founds and not VoIP Skype call.
I found out that for Skype I need to use :
Intent skype = new Intent("android.intent.action.VIEW");
skype.setData(Uri.parse("skype:" + "user_name"));
startActivity(skype);
Is there a way to chain those two intents and whenever I choose phone app to run phone Intent and whenever I choose Skype to run Skype Intent ?
I know I can make a custom dialog to choose Intent to run and exclude Skype app from Intent phone
But I was wondering if there is a more elegant way built in android or even if I can make the VoIp call from the number it self (finding the user from phone).
Thank you in advance

Start and Stop an external app from my own app in Android

My app starts others apps (upon user request) using this simple code:
Intent LaunchApp = getPackageManager().getLaunchIntentForPackage("the.external.app.package");
startActivity( LaunchApp );
Is there a way to finish or close that app?
I have tried with ActivityManager.killBackgroundProcesses() and with android.os.Process.sendSignal(pid, android.os.Process.SIGNAL_KILL) but no success.
The idea is to do something like this:
If the app connects to the car bluetooth then it starts the music player automatically. Once the bluetooth is disconnected it should close the music player.
Thanks
You can close activity without killing process.
Use startActivityForResult() instead startActivity()
startActivityForResult( LaunchApp, 100 );// reques code = 100
Close activity by request code when you need that
finishActivity( 100 );

Options for Skype / Dialer when calling from app

I am creating an application from which the user can call people. In this application I would like to give the option of using either the phone's dialer or other VOIP applications such as Skype or Lync (which incidentally are both Microsoft software). My only problem is that they don't seem to be registered to listen for android.intent.action.CALL (this gives me the phone), but only for android.intent.action.CALL_PRIVILEGED - via which I cannot reach the phone's dialer (I'm guessing that's the privileged part). I'm developing on a stock Nexus 4 btw.
Is there a pretty way that I can launch my intent and be given the option of both the dialer and also Skype/Lync?
Right now my calling the intent looks like this:
Uri numberUri = Uri.parse("tel:" + number);
final Intent intent = new Intent("android.intent.action.CALL_PRIVILEGED");
intent.setData(numberUri);
mContext.startActivity(intent);
Feel free exchange the contents of the intent for Intent.ACTION_CALL - I'm doing it all the time at the moment.
Sorry Dear this cannot be possible.

How to merge two applications?

I am developing an Answering Machine application.
Basically it has to automatically accept the call, give a voice message and start recording the call.
I have designed an application to automatically answer to calls and another application to record calls. Individually both the apps work fine. But after i merged them the application crashes.
I saw a an example here :Combine 2 android apps. I merged the apps same way but still the application crashes.
How can I properly merge my apps?
Try
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("com.example.package", "com.example.package.ActivityToStart");
startActivity(intent);
or
PackageManager pm = getPackageManager();
Intent intent = pm.getLaunchIntentForPackage("com.example.package");
startActivity(intent);
to invoke 2 apps. And retrieve files from their default save location.

Categories

Resources