Reputation: 41
here is my ex code
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button web = (Button) findViewById(R.id.button1);
web.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent();
// set data
intent.setData(Uri.parse("http://apps.samsung.com/mars/appquery/appDetail.as?appId=com.example.hi"));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
startActivity(intent);
}
});
}
i want when i click on web button to open this ex application with Samsung store as direct link, not with the browser .
Upvotes: 4
Views: 2264
Reputation: 644
Create the Intent
like this:
@Override
public void onClick(View v) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("samsungapps://ProductDetail/com.example.hi"))
startActivity(intent)
}
Upvotes: 6