简体   繁体   中英

Create a direct link to google play app download

I have an app on Google Play. I am sending a SMS message to my clients to download the application, there is a link in the SMS to a PHP page where I redirect the user to his relevant store (appstore, google play).

The PHP looks like the following:

$iPod    = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone  = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad    = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");

if( $iPod || $iPhone || $iPad){
  header('Location: ' . APPLE_DOWNLOAD_URL);
}else if($Android){
  header('Location: ' . GOOGLE_DOWNLOAD_URL);
}else {
  header('Location: ' . WEB_DOWNLOAD_URL);
}

My Google_DOWNLOAD_URL is the following:

https://play.google.com/store/apps/details?id=XXX

My first question - is there a way to redirect the user directly to the Google Play, without asking him what to do with the link. I saw some answers about strating with market:// but it's not working.

Second question - is this the best practice to redirect users regarding the mobile device they use?

Thanks a lot,

Hi was having the same problem. Try using

market://details?id=XXX

instead of

https://play.google.com/store/apps/details?id=XXX

This opens up the Play Store directly for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM