For the first one, APNS doesn't provide any callback whether the device received the notification or not.
If you want you can implement something in your device to tell your server whenever it receives a notification.
For the second, you can have some help from this code.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
if ( application.applicationState == UIApplicationStateInactive || application.applicationState == UIApplicationStateBackground )
{
//opened from a push notification when the app was on background
}
}
More help from this answer.
This is called when app was in background. If you want to get information for the app which started by push notification, you need to use the following code, in your didFinishLaunchingWithOptions
UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if (notification) {
NSLog(@"app recieved notification from remote%@",notification);
[self application:application didReceiveRemoteNotification:(NSDictionary*)notification];
}else{
NSLog(@"app did not recieve notification");
}