简体   繁体   中英

Notification on change application

In my music app i am allow background to work too.

And i noticed that in this order of actions the app stop playing music: In the app the user press the lock screen -> then he get msg in sms or whatsapp.... and then he slide the msg notification to open the msg app.

There is any method that i can get notification when the user made this actions?

I am using already:

- (void)applicationDidEnterBackground:(UIApplication *)application

and this notify me when the user press the lockscreen button.

When a notification appears on screen, you should get -applicationWillResignActive: . (This also happens if the user locks the device, gets a phone call, or a number of other things.) If the user dismisses the notification and returns to your app, you should get -applicationDidBecomeActive: . Unfortunately, there's no way to tell what's going on with another app's push notifications beyond that.

However, I'm not sure you're barking up the right tree here. If you're having trouble with other apps interrupting your audio, this Stack Overflow post may point you to some resources that can help.

Check out this link ... Here you can get a list of the background processes running in your device. With that you may be able to check if message app is running or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM