예제 #1
0
  public static void closeNavi(final Context context) {
    if (APPUtil.getInstance().isInstalled(APPUtil.GD_CARJ_PKG)) {
      Intent mIntent = new Intent("AUTONAVI_STANDARD_BROADCAST_RECV");
      mIntent.putExtra("KEY_TYPE", 10010);
      context.sendBroadcast(mIntent);

      BridgeApplication.uiHandler.postDelayed(
          new Runnable() {

            @Override
            public void run() {
              APPUtil.forceStopPackage(APPUtil.GD_CARJ_PKG, context);
            }
          },
          1000);
    }
    if (APPUtil.getInstance().isInstalled(APPUtil.GD_CAR_PKG)) {
      Intent intent = new Intent("AUTONAVI_STANDARD_BROADCAST_RECV");
      intent.putExtra("KEY_TYPE", 10021);
      context.sendBroadcast(intent);

      BridgeApplication.uiHandler.postDelayed(
          new Runnable() {
            @Override
            public void run() {
              APPUtil.forceStopPackage(APPUtil.GD_CAR_PKG, context);
            }
          },
          1500);
    }
    if (APPUtil.getInstance().isInstalled(APPUtil.GD_MAP_PKG)) {
      context.sendBroadcast(new Intent("com.amap.stopnavi"));
      Intent mIntent = new Intent("com.autonavi.minimap.carmode.command");
      mIntent.putExtra("NAVI", "APP_EXIT");
      context.sendBroadcast(mIntent);

      BridgeApplication.uiHandler.postDelayed(
          new Runnable() {

            @Override
            public void run() {
              APPUtil.forceStopPackage(APPUtil.GD_MAP_PKG, context);
            }
          },
          1000);
    }
    if (APPUtil.getInstance().isInstalled(APPUtil.BD_NAVI_PKG)) {
      context.sendBroadcast(new Intent("com.baidu.navi.quitnavi"));

      BridgeApplication.uiHandler.postDelayed(
          new Runnable() {

            @Override
            public void run() {
              APPUtil.forceStopPackage(APPUtil.BD_NAVI_PKG, context);
            }
          },
          1000);
    }
    if (APPUtil.getInstance().isInstalled(APPUtil.BD_MAP_PKG)) {
      APPUtil.forceStopPackage(APPUtil.BD_MAP_PKG, context);
    }
    if (APPUtil.getInstance().isInstalled(APPUtil.KLD_MAP_PKG)) {
      Intent i = new Intent("android.NaviOne.AutoExitReceiver");
      context.sendBroadcast(i);

      BridgeApplication.uiHandler.postDelayed(
          new Runnable() {

            @Override
            public void run() {
              APPUtil.forceStopPackage(APPUtil.KLD_MAP_PKG, context);
            }
          },
          1000);
    }
    if (APPUtil.getInstance().isInstalled(APPUtil.MX_MAP_PKG)) {
      APPUtil.forceStopPackage(APPUtil.MX_MAP_PKG, context);
    }
    if (APPUtil.getInstance().isInstalled(APPUtil.GG_MAP_PKG)) {
      APPUtil.forceStopPackage(APPUtil.GG_MAP_PKG, context);
    }
  }
예제 #2
0
  /** 一键导航 */
  public static void openONENavi(Context context) {
    int navi = Settings.System.getInt(context.getContentResolver(), ONE_NAVI, 0);
    switch (navi) {
      case 1:
        if (APPUtil.getInstance().isInstalled("com.coagent.ecar")) {
          Intent tmpIntent = new Intent("com.android.ecar.recv");
          tmpIntent.putExtra("ecarSendKey", "MakeCall");
          tmpIntent.putExtra("cmdType", "standCMD");
          tmpIntent.putExtra("keySet", "");
          context.sendBroadcast(tmpIntent);
        } else {
          ComponentName componetName =
              new ComponentName("com.coagent.app", "com.coagent.activity.MainActivity");
          Intent ecar = new Intent();
          ecar.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          ecar.setComponent(componetName);

          try {
            context.startActivity(ecar);
          } catch (Exception e) {
          }
        }
        break;
      default:
        int enable = 1;
        try {
          Cursor query =
              context
                  .getContentResolver()
                  .query(
                      Uri.parse("content://com.colink.bluetoothe/bluetootheonline"),
                      null,
                      null,
                      null,
                      null);
          if (query != null) {
            if (query.moveToNext()) {
              enable = query.getInt(query.getColumnIndex("support"));
            }
            query.close();
          }
        } catch (Exception e) {
        }
        if (enable == 1) {
          if (APPUtil.getInstance().isInstalled("com.share.android")) {
            Intent intent = new Intent("tianan.cloudcall.action.CALL");
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            try {
              context.startActivity(intent);
            } catch (Exception e) {
            }
          } else {
            Intent intent = new Intent("com.glsx.bootup.receive.autonavi");
            intent.putExtra("autonaviType", 1); // autonaviType为1:表示直接发起导航请求,
            // autonaviType为2:只进入导航主页面(不发起请求);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            try {
              context.startActivity(intent);
            } catch (Exception e) {
            }
          }
        } else {
          Intent intent = new Intent("com.glsx.bootup.receive.autonavi");
          intent.putExtra("autonaviType", 1); // autonaviType为1:表示直接发起导航请求,
          // autonaviType为2:只进入导航主页面(不发起请求);
          intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          try {
            context.startActivity(intent);
          } catch (Exception e) {
          }
        }

        break;
    }
  }