简体   繁体   English

适用于Android的Dropbox Core API:如何检查设备上是否已安装drpbox官方应用

[英]Dropbox core api for android:how to check if drpbox official app in installed on device

I am developing an android app where user has to login in dropbox,the problem is that in browser activity user stucks on dropbox's [consent screen] ( https://stackoverflow.com/questions/23402984/dropbox-core-api-for-android-activity-stops-after-authentication ) .on pressing allow button the browser activity doesn't close . 我正在开发一个Android应用,用户必须在Dropbox中登录,问题是在浏览器活动中,用户卡在了Dropbox的[同意屏幕]( https://stackoverflow.com/questions/23402984/dropbox-core-api-for- android-activity-stops-after-authentication )。按“允许”按钮后,浏览器活动不会关闭。 Then i tried a dropbox app installed device,which removes the need of going through browser acitivity and returns dropbox key and secret so this directly can solve my problem . 然后,我尝试了一个安装了Dropbox应用程序的设备,它消除了浏览器主动性的需要,并返回了Dropbox密钥和机密,因此这可以直接解决我的问题。

So how could I know before starting my activity if device has dropbox app installed or not? 因此,在开始活动之前,我如何知道设备是否安装了Dropbox应用程序? Any api call I can use? 我可以使用任何API调用吗?

you have to know the package name of dropbox app and then u can use this function to know whether it is installed or not :- 您必须知道保管箱应用程序的软件包名称,然后您才能使用此功能来知道它是否已安装:-

private boolean isInstalled(String pack) {
        PackageManager pm = getPackageManager();
        boolean app_installed = false;
        try {
            pm.getPackageInfo(pack, PackageManager.GET_ACTIVITIES);
            app_installed = true;
        } catch (PackageManager.NameNotFoundException e) {
            app_installed = false;
        }
        return app_installed;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM