ionic-team / ionic-plugin-deeplinks

Handle deeplinks into your Ionic/Cordova apps from Universal Links, App Links, and Custom URL schemes. For those using Ionic 2, there are some nice goodies that make life easier.
Other
332 stars 219 forks source link

Deeplinking Lyft app from ionic app Android #83

Open FarhanSaleem opened 7 years ago

FarhanSaleem commented 7 years ago

Hi, I am building an ionic app and am using the ionic-plugin-deeplinks to test it on my Android phone. I have configured the link to open like this when i click on the Lyft button but am not sure if the target, parent values are set correctly and currently nothing happens when i start this function on a button click, it does not bring up the Lyft app and does not give me an error either

I am trying to follow the example the plugin provides here https://github.com/driftyco/ionic1-deeplinks-demo/blob/master/www/js/app.js

Looking at Lyft deeplinking: https://developer.lyft.com/docs/deeplinking

Can someone point out what the target and parent values should be in my case if i have the current location and want the app to open with passing in the lat,lng via this plugin call? I have the lat,lng info but right now its not even launching the Lyft app.

The plugin is configured in my config.xml as follows

And this is the code for calling the Lyft app

 $ionicPlatform.ready(function() {
// Note: route's first argument can take any kind of object as its data,
// and will send along the matching object if the route matches the deeplink
console.log('Calling Lyft...');
$cordovaDeeplinks.route({
  '/ridetype?id=lyft': {
    target: 'id',
    parent: 'ridetype'
  }
}).subscribe(function(match) {
  // One of our routes matched, we will quickly navigate to our parent
  // view to give the user a natural back button flow
  $timeout(function() {
    $state.go(match.$route.parent, match.$args);

    // Finally, we will navigate to the deeplink page. Now the user has
    // the 'product' view visibile, and the back button goes back to the
    // 'products' view.
    $timeout(function() {
      $state.go(match.$route.target, match.$args);
    }, 800);
  }, 100); // Timeouts can be tweaked to customize the feel of the deeplink
}, function(nomatch) {
  console.warn('No match', nomatch);
});

});

When i am looking at the console and run my app i also see this on the console output

D/IonicDeeplinkPlugin(20460): IonicDeepLinkPlugin: firing up... D/IonicDeeplinkPlugin(20460): Got a new intent: null null android.intent.action.MAIN null

Looking for some helpful insight to launch the Lyft app with the plugin looking at my code above. Your help is really appreciated! Thank you!

FdezRomero commented 7 years ago

If I understood it right, you want to open the Lyft app from your Android app by using their deeplinks. This plugin allows your app to receive deeplinks (intents), buy in your case you need to send them to the Lyft app. Try the WebIntent plugin and its startActivity() method instead.

FarhanSaleem commented 7 years ago

Hi @FdezRomero Thanks for replying, you are correct! I want to launch the Lyft app from my app via deeplink, I thought this plugin helps launch other apps as well. I looked at the WebIntent plugin and noticed its supported for android. Later on I would like to do the same thing for the ios app since I want to support that too. Is there a plugin which is good and supports both Android and ios platforms? Please let me know, thanks

FdezRomero commented 7 years ago

You can check the plugins available at Ionic Native at see if any fit your needs. Since this is not really an issue with the plugin, I suggest you to close this and continue the conversation at the Ionic 2 forums if you need help on how to implement something.