0

I have a user click event for a button on a web page.

$('.hr_rd_s').click(function() {    
    window.open('gift.php', '_blank');
    //automatically install Android app code goes here    
});
<a href="#" class="hr_rd_s"> 
    <span id="text15" class="answer">Left</span>
</a>

For example, if user is on Android phone, I want the app to be automatically installed on user click event. This page would be only rendered to Android phone users.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Irfan
  • 4,882
  • 12
  • 52
  • 62

2 Answers2

1

You can't automatically install an Android app. That would be a huge security issue. You can link to the app in the Google Play store where the user must install it. It is also possible to link to an Android installation file

  • If I dowonload the APK and place it on my server. Is it possible to install it from my own server via Jquery click? – Irfan May 12 '15 at 10:16
  • See [Linking to Your Products](https://developer.android.com/distribute/tools/promote/linking.html). – minipif May 12 '15 at 10:17
  • You can never install anything automatically on a user. That would be a huge security flaw. – Dag Mikkelsen May 12 '15 at 12:04
0

you might use JavascriptInterface to communicate between Web/PHP/HTML/Javascript and native Java. check out this question and answer

and then from code you may call Intent to Google Play to this app, HOWTO here.

it's not possible to automatically install any app without user confirmation, security reasons of course

Community
  • 1
  • 1
snachmsm
  • 17,866
  • 3
  • 32
  • 74