Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 5    Views: 158

Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
09/24/13 04:44 PM (12 years ago)

Custom URL open app or App Store

This was an answer to an earlier post, for the buzztouch users that avoid HELP and any assistance posts here's the code so you don't miss out lol Here's a quick tutorial modifying the code for the Launch Native App plugin here's the vid http://www.youtube.com/watch?v=IhQmTXZlJzY&feature=youtube_gdata_player In BT_viewControllerManager.m replace the lines 455 - 463 with this //customURLScheme if([appToLaunch isEqualToString:@"customURLScheme"]){ NSArray* splitEncodedURL = [encodedURL componentsSeparatedByString:@"&&&"]; NSString* customURL = [splitEncodedURL objectAtIndex:0]; NSString* appstoreLink = [splitEncodedURL objectAtIndex:1]; if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:customURL]]) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]]; }else{ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:appstoreLink]]; } } In the control panel in the launch native app screen add this for the data string I have used facebook as an example note it is &&& that splits the 2 links fb://&&&https://itunes.apple.com/gb/app/facebook/id284882215?mt=8 it parses too fb:// and https://itunes.apple.com/gb/app/facebook/id284882215?mt=8 the first must be the customURL scheme the 2nd is the appstore link, the app link can be an affiliate link it makes no difference. please bare in mind there are no error functions now so make sure your link is correct. this tutorial can be expanded further such as having the appstore open in app with out leaving your app having error features just incase of a typo in your control panel having the menu screen indicate whether it will open or go to App Store, could be alert or visual indicator on menu row. I'm sure one of the tutorial legends will mop this up and type it more neatly.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
09/24/13 04:51 PM (12 years ago)
The video is awful it is demonstrating first that currently if it can't open the url it just says it cant in the alert view. with this simple mod you can send them to the appstore to buy it instead.
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
09/24/13 04:58 PM (12 years ago)
 
Fhinumina
Lost but trying
Profile
Posts: 3
Reg: Sep 23, 2013
Chicago
1,380
like
09/24/13 05:36 PM (12 years ago)
Thanks kittsy for your advise
 
Kittsy
buzztouch Evangelist
Profile
Posts: 2251
Reg: Feb 22, 2012
Liverpool
31,360
like
09/25/13 04:26 AM (12 years ago)
Hi Fhinumina java and c++ are both object orientated languages if you find the BT_viewControllerManager.m equivalent in android find where it handles the custom url you just substitute the syntax bare in mind I haven't tested this and also have not got teh android version of viewcontrollermanager the java version of this NSArray* splitEncodedURL = [encodedURL componentsSeparatedByString:@"&&&"]; NSString* customURL = [splitEncodedURL objectAtIndex:0]; NSString* appstoreLink = [splitEncodedURL objectAtIndex:1]; is this String[] splitEncodedURL = encodedURL.split("&&&"); String customURL = splitEncodedURL[0]; String appstoreLink = splitEncodedURL[1]; the rest should be self explanatory
 
SheriDee
Code is Art
Profile
Posts: 1094
Reg: Sep 23, 2011
location unknow...
22,840
like
09/25/13 07:40 AM (12 years ago)
Thanks doll! Putting this in my bag of tricks...:)
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.