Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capability to open app or redirect to AppStore #72

Open
victorjspinto opened this issue Nov 27, 2017 · 7 comments
Open

Add capability to open app or redirect to AppStore #72

victorjspinto opened this issue Nov 27, 2017 · 7 comments

Comments

@victorjspinto
Copy link

Hello!!

Nice project that you have here!

I would like to improve this project with a simple snipet that detect that app is already installed and redirect to it or app wans't installed and redirect to app store.

It could improve the user experience =D

Here are the proposal:

iOS

When smartbanner opens on iOS, the following snippet may apply:

var ifrm = document.getElementById("innerFrame");
function redirect_to_store() {
  if (!document.hidden) {
    window.location.href = store_link;
  }
}
try {
  ifrm.src = app_link;
} catch (e) {
  window.location.href = store_link;
}
setTimeout (redirect_to_store, 1000);

Android

On android, we can use something called Intent Links. Here is a post with better explanation.

https://developer.chrome.com/multidevice/android/intents

We can define some metas with data needed and i can made an PullRequest =)

Hope i can help :)

@ain
Copy link
Owner

ain commented Nov 27, 2017

Thanks for the ticket @victorjspinto!

Interesting proposition. During the creation of smartbanner.js I dont think Android intents were there for us to use, but it definitely sounds good. If you're willing to put in the work, I'd love to merge it.

Few things for you to consider when submitting the PR:

  • Legacy support. The feature has to be built using an option deliverable over a meta tag and it should not be a default option. Current users should not be affected or forced to upgrade.
  • Unit tests. Every feature has to have a spec footprint. I can assist here, we can collaborate.

@ain
Copy link
Owner

ain commented Nov 27, 2017

If we need a breaking change, we could also bump to 2.0.0. I think this feature would be big enough to go up one major version anyway.

@ryuran
Copy link

ryuran commented Jul 26, 2018

Hello @victorjspinto , @ain
Do you have a branch somewhere to test or give some help ?

@cAstraea
Copy link

cAstraea commented Dec 6, 2018

Is it possible to know if the app is installed and say open instead of view ?

@ain
Copy link
Owner

ain commented Dec 29, 2018

@cAstraea currently not, but as you see from the above exchange, @victorjspinto had a rough idea how this could be implemented for iOS.

I'd be more than glad to work on a Pull Request if some of you can jump start the work needed.

@Hanzofm
Copy link

Hanzofm commented Jun 4, 2021

Hi @ain It is currently possible to detect if is app installed then redirect to it or its planning to implement it?

@ain
Copy link
Owner

ain commented Jun 22, 2021

@Hanzofm time has moved on since this discussion was originally opened and things have changed. Which of course also reveals how high maintenance such a feature would be.

There are scenarios for both Android and iOS that could deliver the feature. PR is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants