简体   繁体   中英

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 . 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 .

So how could I know before starting my activity if device has dropbox app installed or not? Any api call I can use?

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;
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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