Hi I have an app for Android phones.

It is working as intended but when I receive a phone call the app is minimised(but still running) and I have to open the app again.

I was wondering how do I make it so after the phone call it restores my app.

I've found other apps can do this e.g. angry birds but I'm struggling to find examples online.

Use PhoneStateLisenter to listen out for changes in the call state, with the onCallStateChanged method.
Once state change from CALL_STATE_OFFHOOK to CALL_STATE_IDLE trigger/wake-up your application

Thanks thats exactly how I ended up doing it.

I stored my phones state and compared it to the current phone state to notice a change.

then set set an alarm which triggers my app to open 10 secs later.

here is the code if anyone else gets stuck like I did.

youActivity act = this;
AlarmManager mgr = (AlarmManager)act.getSystemService(Context.ALARM_SERVICE);
RESTART_INTENT = PendingIntent.getActivity(this.getBaseContext(), 0, new Intent(getIntent()), getIntent().getFlags());
.
.
.
if(Globals.lastPhoneState != Globals.telephonyManager.getCallState())
        {
	        mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 10000, RESTART_INTENT);
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.