Android Context Check isMobilityInstalled(Context context)

Here you can find the source of isMobilityInstalled(Context context)

Description

Returns true if mobility and accelservice are installed

Parameter

Parameter Description
context a parameter

Declaration

public static boolean isMobilityInstalled(Context context) 

Method Source Code

//package com.java2s;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

public class Main {
    /**/*from   w  ww.  jav  a 2  s.  c  o  m*/
     * Returns true if mobility and accelservice are installed
     * 
     * @param context
     * @return
     */
    public static boolean isMobilityInstalled(Context context) {
        return getMobilityPackageInfo(context) != null;
    }

    /**
     * Returns the mobility package info if mobiliy and accelservice exist
     * 
     * @param context
     * @return the mobility package info
     */
    private static PackageInfo getMobilityPackageInfo(Context context) {
        try {
            PackageManager pm = context.getPackageManager();
            return pm.getPackageInfo("org.ohmage.mobility", 0);
        } catch (PackageManager.NameNotFoundException e) {
            // Don't do anything
        }
        return null;
    }
}

Related

  1. isInstalledThroughPlayStore(final Context context)
  2. isLandscape(Context context)
  3. isLandscape(final Context context)
  4. isLocationEnabledGPS(Context c)
  5. isMobile(Context context)
  6. isNetAvailable(Context context)
  7. isOnline(Context c)
  8. isOnline(Context context)
  9. isOnline(Context context)