How to resume an action when quitting with home button?
I'm developping a SIP application. I have a little problem: when "reducing" the application with home button and i make a call to the phone, i have the coded ringing incoming call but the application doesn't shows. How to pops up all the application UI when having an incoming call ? Thank you for your help. EDIT:
public class IncomingCallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Dialog dialog开发者_StackOverflow社区 = new Dialog(context,intent);
dialog.répondre();
}
}
So, you have an Activity that is stopped and you want to pop it up when call arrives. Approach I would suggest:
- originally start that Activity with flag FLAG_ACTIVITY_SINGLE_TOP
- override function onNewIntent() in that Activity and process incoming Intent depending on action code from Intent (you define them to distinguish reasons for popping up)
- when you want to move that Activity to foreground again, call startActivity() with some action code (you can to that from Service as well). If Activity is not started, it will be. If it is started, it will not be re-started but resumed and you will receive your Intent in onNewIntent() and your Activity will be moved to foreground.
UPDATE:
onNewIntent() handling example:
\android-sdk-windows\samples\android-8\ApiDemos\src\com\example\android\apis\app\SearchQueryResults.java
精彩评论