Launch Dropbox from my app Android

拈花ヽ惹草 提交于 2019-12-03 04:07:09

Try using PackageManager and getLaunchIntentForPackage() with the package name for DropBox, i.e com.dropbox.android. You will get a PackageManager.NameNotFoundException if Dropbox isn't installed.

If what you want is to share a file by lauching dropbox , you can use ACTION_SEND :

Intent intent = new Intent(Intent.ACTION_SEND);
startActivity(Intent.createChooser(intent, "title");

you can also send a specific file :

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType(fileType); 
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(file.getPath()));  
startActivity(Intent.createChooser(intent, "title"));

See this article to understand the convention behind ACTION_SEND.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!