Last active
          August 29, 2015 14:02 
        
      - 
      
- 
        Save joseadrian/3c7cb771afc208956fb8 to your computer and use it in GitHub Desktop. 
    Open app if installed. If not, open store @source: https://www.waze.com/es-419/about/dev
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | try | |
| { | |
| String url = "waze://?q=Hawaii"; | |
| Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( url ) ); | |
| startActivity( intent ); | |
| } | |
| catch ( ActivityNotFoundException ex ) | |
| { | |
| Intent intent = | |
| new Intent( Intent.ACTION_VIEW, Uri.parse( "market://details?id=com.waze" ) ); | |
| startActivity(intent); | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | - (void) navigateToLatitude:(double)latitude | |
| longitude:(double)longitude | |
| { | |
| if ([[UIApplication sharedApplication] | |
| canOpenURL:[NSURL URLWithString:@"waze://"]]) { | |
| // Waze is installed. Launch Waze and start navigation | |
| NSString *urlStr = | |
| [NSString stringWithFormat:@"waze://?ll=%f,%f&navigate=yes", | |
| latitude, longitude]; | |
| [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr]]; | |
| } else { | |
| // Waze is not installed. Launch AppStore to install Waze app | |
| [[UIApplication sharedApplication] openURL:[NSURL | |
| URLWithString:@"http://itunes.apple.com/us/app/id323229106"]]; | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment