コード例 #1
0
 protected void executeNewCmd(String cmd, String args) {
   Intent i = new Intent(MainService.ACTION_COMMAND);
   i.putExtra("cmd", cmd);
   if (args != null) {
     i.putExtra("args", args);
   }
   i.setClassName("com.googlecode.gtalksms", "com.googlecode.gtalksms.MainService");
   sMainService.startService(i);
 }
コード例 #2
0
 @Override
 protected boolean onPictureSaved(File picture) {
   Intent i = new Intent(MainService.ACTION_COMMAND);
   i.setClass(ctx, MainService.class);
   i.putExtra("from", recipient);
   i.putExtra("cmd", "send");
   i.putExtra("args", picture.getAbsolutePath());
   MainService.sendToServiceHandler(i);
   return true;
 }
コード例 #3
0
  CommandHandlerBase(MainService mainService, int cmdType, Object... commands) {
    if (sMainService == null) {
      sMainService = mainService;
      sSettingsMgr = SettingsManager.getSettingsManager(sContext);
      sContext = mainService.getBaseContext();
      Cmd.setContext(sContext);
    }
    mCommandMap = new HashMap<String, Cmd>();
    for (Object o : commands) {
      Cmd c = (Cmd) o;
      mCommandMap.put(c.getName(), c);
    }
    mCmdType = cmdType;
    mAnswerTo = null;

    initializeSubCommands();
  }
コード例 #4
0
ファイル: XmppBuddies.java プロジェクト: sd542927172/gtalksms
  // carefull, this method does also get called by the SmackListener Thread
  @Override
  public void presenceChanged(Presence presence) {
    String bareUserId = StringUtils.parseBareAddress(presence.getFrom());

    Intent intent = new Intent(MainService.ACTION_XMPP_PRESENCE_CHANGED);
    intent.putExtra("userid", bareUserId);
    intent.putExtra("fullid", presence.getFrom());
    intent.putExtra("state", retrieveState(presence.getMode(), presence.isAvailable()));
    intent.putExtra("status", presence.getStatus());
    sContext.sendBroadcast(intent);

    // TODO Make this a general intent action.NOTIFICATION_ADDRESS_AVAILABLE
    // and handle it for example within XmppPresenceStatus
    // if the notification address is/has become available, update the resource status string
    if (sSettings.containsNotifiedAddress(bareUserId) && presence.isAvailable()) {
      intent = new Intent(MainService.ACTION_COMMAND);
      intent.setClass(sContext, MainService.class);
      intent.putExtra("cmd", "batt");
      intent.putExtra("args", "silent");
      MainService.sendToServiceHandler(intent);
    }
  }
コード例 #5
0
 protected void send(XmppMsg message, String to) {
   sMainService.send(message, to);
 }