@Override
  public FREObject call(FREContext context, FREObject[] args) {
    super.call(context, args);

    try {
      return FREObject.newObject(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP);
    } catch (FREWrongThreadException e) {
      e.printStackTrace();
    }

    return null;
  }
 @Override
 public FREObject call(FREContext context, FREObject[] arg1) {
   // TODO 自動生成されたメソッド・スタブ
   try {
     Activity activity = context.getActivity();
     mAudio = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
     int rtn = mAudio.getRingerMode();
     return FREObject.newObject(rtn);
   } catch (FREWrongThreadException e) {
     e.printStackTrace();
   }
   return null;
 }
Esempio n. 3
0
  public FREObject call(FREContext ctx, FREObject[] passedArgs) {

    FREObject result = null;
    String BASE64_PUBLIC_KEY = null;
    Activity act;

    try {
      BASE64_PUBLIC_KEY = passedArgs[0].getAsString();
      act = ctx.getActivity();
      checkLicense(ctx, act, BASE64_PUBLIC_KEY);
      result = FREObject.newObject(1);

    } catch (FRETypeMismatchException e) {
      System.out.println("##### AndroidLicensing - caught FRETypeMismatchException");
      e.printStackTrace();
    } catch (FREInvalidObjectException e) {
      System.out.println("##### AndroidLicensing - caught FREInvalidObjectException");
      e.printStackTrace();
    } catch (FREWrongThreadException e) {
      System.out.println("##### AndroidLicensing - caught FREWrongThreadException");
      e.printStackTrace();
    }
    return result;
  }
  @Override
  public FREObject call(FREContext context, FREObject[] args) {
    Log.d(TAG, "Entering RetrieveSimpleContacts.call()");

    FREObject simpleContacts = null;

    try {
      int batchStart = args[0].getAsInt();
      int batchLength = args[1].getAsInt();
      simpleContacts =
          ((ContactEditorContext) context).retrieveContactsSimple(batchStart, batchLength);
    } catch (IllegalStateException e) {
      e.printStackTrace();
    } catch (FRETypeMismatchException e) {
      e.printStackTrace();
    } catch (FREInvalidObjectException e) {
      e.printStackTrace();
    } catch (FREWrongThreadException e) {
      e.printStackTrace();
    }

    Log.d(TAG, "Exiting RetrieveSimpleContacts.call()");
    return simpleContacts;
  }
Esempio n. 5
0
  @Override
  public FREObject call(FREContext arg0, FREObject[] arg1) {

    String eventName = null;

    try {
      eventName = arg1[0].getAsString();
    } catch (IllegalStateException e) {
      e.printStackTrace();
    } catch (FRETypeMismatchException e) {
      e.printStackTrace();
    } catch (FREInvalidObjectException e) {
      e.printStackTrace();
    } catch (FREWrongThreadException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }

    HashMap<String, String> params = new HashMap<String, String>();

    if (arg1[1] != null && arg1[2] != null) {
      FREArray paramsKeys = (FREArray) arg1[1];
      FREArray paramsValue = (FREArray) arg1[2];

      try {
        long paramsLength = paramsKeys.getLength();
        for (long i = 0; i < paramsLength; i++) {
          FREObject key = paramsKeys.getObjectAt(i);
          FREObject value = paramsValue.getObjectAt(i);
          String keyString = key.getAsString();
          String valueString = value.getAsString();
          Log.d(TAG, "[" + keyString + "] -> " + valueString);
          params.put(keyString, valueString);
        }

      } catch (FREInvalidObjectException e) {
        e.printStackTrace();
      } catch (FREWrongThreadException e) {
        e.printStackTrace();
      } catch (IllegalStateException e) {
        e.printStackTrace();
      } catch (FRETypeMismatchException e) {
        e.printStackTrace();
      } catch (Exception e) {
        e.printStackTrace();
      }
    } else if (arg1[1] != null) {
      Log.e(TAG, "parameterValues is null while parameterKeys is not");
    } else if (arg1[2] != null) {
      Log.e(TAG, "parameterKeys is null while parameterValues is not");
    }

    if (eventName != null) {
      if (params != null && params.size() > 0) {
        Log.d(TAG, "log event with params");
        FlurryAgent.logEvent(eventName, params);
        // FlurryAgent.onEvent(eventName, params);
      } else {
        Log.d(TAG, "log event without params");
        FlurryAgent.logEvent(eventName);
        // FlurryAgent.onEvent(eventName);
      }
    } else {
      Log.d(Extension.TAG, "null event name");
    }

    return null;
  }