Open Another App with android.intent.action.VIEW

2019-05-23 10:07发布

I want to open another app and open a specific page in it! in their guide they said to use the bellow for default action

android.intent.action.VIEW

and use a kind of intent, which didn't get which, like bellow to go to that specific page:

somecompany://details?id=com.example.calendar

but i don't know how! And i tryed a ton of solutions but coudn't do it !

Thanks for your help.

2条回答
爷的心禁止访问
2楼-- · 2019-05-23 11:00

I think this is what you're asking for. This will open a specific app's page in the Google Play store.

startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(
    "market://details?id=com.mycompany.mypackage")));

Don't replace the word market. That is specifically reserved by Android to open the Google Play store.

查看更多
狗以群分
3楼-- · 2019-05-23 11:00

You can launch an app using intents. But to go to a specific page in the app, there should be a pre defined intent to reach there. Either it can be custom intent defined by that app and exposed to others or may be predefined system app. For example, you can open Settings application and reach a particular page in it based on the intents "Setting Application" has defined. Another example is "Camera Application". You can launch it and reach some page in it but not all pages.

In your case you may try something like this though:

Intent intent = new Intent(Intent.ACTION_VIEW); 
intent.setDataAndType(uri, "video/mp4"); 

I hope you understand what I meant.

查看更多
登录 后发表回答