Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to open link of samsungapps store in application

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 .

like image 717
user3185343 Avatar asked Sep 15 '25 23:09

user3185343


1 Answers

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)
}
like image 102
user3193413 Avatar answered Sep 18 '25 17:09

user3193413