I Checked for answers on stack overflow, but no avail.
final String appPackageName = "com.exmaple.package"; // getPackageName() from Context or Activity object
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName+"&rdid="+appPackageName)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
}
I have tried this code, This will launch playstore or browser. But i need to install the application directly without pressing the install or accept permissions.