I'm trying to get a custom push with Urban Airship and phonegap to redirect view. Basically I want to send a custom data push that would look like:
"aps": {"alert": "Hello!", "extra":{"targetURL":"www.google.com"}}
and for the app's view to be redirected to the targetURL.
Right now my notification handler is:
-(void)handleNotification:(NSDictionary *)notification withCustomPayload:(NSDictionary *)customData{
UALOG(@"Received an alert with a custom payload");
NSString *URL = [customData objectForKey:@"targetURL"];
//UIWebView *view = [PhoneGapDelegate
AppDelegate *mainDelegate = (AppDelegate *) [[UIApplication sharedApplication] delegate];
[mainDelegate redirectTo:URL];
}
the redirect function looks like the following and is in the AppDelegate:
- (void) redirectTo:(NSString *){
URL{NSLog(@"In redirect in cocoa");
[[self webView] stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"goTo('%@');", URL]];
}
This code does call the javascript function i use to redraw the view but i cannot get it to redraw once i send the notification. Any help in making the view redraw will be helpful either doing it this way or another more effective way would be appreciated.