RadZaeem
RadZaeem

Reputation: 311

Reopen activity directly after finishing a phone call

After I make a call with phone call intent and finish the call, the phone opens calls log instead of directly reopen the app activity which launches the call intent.

How do I skip going to the call log? After finishing the call I want the phone to come back to my app activity?

Upvotes: 0

Views: 836

Answers (3)

adithi
adithi

Reputation: 11

launch/reopen the previous activity and set flag Intent.FLAG_ACTIVITY_SINGLE_TOP to the intent. if this flag set, the activity will not be launched if it is already running at the top of the history stack.

Upvotes: 1

RadZaeem
RadZaeem

Reputation: 311

Tried this to reopen app but the app crash

Intent i = new Intent("android.intent.action.MAIN");    
i.setComponent(new ComponentName("com.muaz", "HantarSMS") );
i.addCategory("android.intent.category.LAUNCHER");
startActivity(i);

Upvotes: 0

ludwigm
ludwigm

Reputation: 3383

You can watch the Broadcast of android.intent.action.PHONE_STATE and for the extra EXTRA_STATE. If it is EXTRA_STATE_IDLE the call is finished and you can implement the logic to reopen your app

Upvotes: 0

Related Questions