No Activity found to handle Intent

后端 未结 6 1450
攒了一身酷
攒了一身酷 2020-12-01 17:35

i am attempting to launch an intent to open a link to the android market.

android manifest portion looks like this:



        
6条回答
  •  无人及你
    2020-12-01 18:24

    private void OpenStoreIntent(){
            String url="";
            Intent storeintent=null;
            try {
                url = "market://details?id=com.myapp.packagename";
                storeintent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                storeintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
                context.startActivity(storeintent);
            } catch ( final Exception e ) {
                url = "https://play.google.com/store/apps/details?id=com.myapp.packagename";
                storeintent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                storeintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
                context.startActivity(storeintent);
            }
    
        }
    

提交回复
热议问题