0

This is my code for getting a remote message from the pusher.

self.pusher = [PTPusher pusherWithKey:@"pusherKey" delegate:self encrypted:YES cluster:@"ap2"];
PTPusherChannel *channel = [self.pusher subscribeToChannelNamed:@"my-channel"];

[channel bindToEventNamed:@"my-event" handleWithBlock:^(PTPusherEvent *channelEvent) {
    NSString *message = [channelEvent.data objectForKey:@"message"];
    }];

[self.pusher connect];
Arasuvel
  • 2,971
  • 1
  • 25
  • 40
Lenin S
  • 5
  • 6
  • please refer... https://stackoverflow.com/questions/16393673/detect-if-the-app-was-launched-opened-from-a-push-notification – Shah Nilay Aug 04 '17 at 06:09

1 Answers1

0

No, it is not possible to launch app automatically when in the background. Performing some short task is available but not launch app.

ColeX
  • 14,062
  • 5
  • 43
  • 240
  • Now I got remote message using UIBackgroundTaskIdentifier when app is in bakground. – Lenin S Aug 04 '17 at 06:59
  • @LeninS what you want to achieve ,Did my answer confuse you ? – ColeX Aug 04 '17 at 07:04
  • I want to open the app when I get the remote message. – Lenin S Aug 04 '17 at 07:26
  • As my answer mentioned, it is not available . https://stackoverflow.com/questions/32249797/ios-automatically-open-app-from-background – ColeX Aug 04 '17 at 07:52
  • Thanks for your answer Cole Xia. I have used a local notification there. And I need to know is there any way to open the app without tapping that notification. – Lenin S Aug 04 '17 at 09:11
  • @LeninS No, you must tap the notification if you are going to open the app. Other ways to open the app is tapping the App extention , link:https://developer.apple.com/app-extensions/ and use custom url scheme,link:http://www.idev101.com/code/Objective-C/custom_url_schemes.html – ColeX Aug 08 '17 at 02:08
  • Thanks Brother. Now I am looking for getting remote message when app is terminated. – Lenin S Aug 08 '17 at 06:33