Пример #1
0
 /**
  * Send Message to service.
  *
  * @param msg
  */
 public void displayCheckcode(String code) {
   Bundle bundle = new Bundle();
   bundle.putString("ID", code);
   android.os.Message message =
       android.os.Message.obtain(null, ActivityCommunicator.SHOW_CHECKCODE);
   message.setData(bundle);
   if (mIsBound) {
     try {
       mRemoteMessenger.send(message);
     } catch (RemoteException ex) {
       Logger.getLogger(ActivityCommunicator.class.getName()).log(Level.SEVERE, null, ex);
     }
   } else {
     mPendingMessages.add(message);
     mNM.notify(
         CandisNotification.NOTIFICATION_ID,
         CandisNotification.getNotification(mContext, "Checkcode required"));
   }
 }
Пример #2
0
 public void OnCheckServerCert(X509Certificate cert, ReloadableX509TrustManager tm) {
   // send certificate to activity
   Message msg = Message.obtain(null, CHECK_SERVERCERT);
   Bundle certData = new Bundle();
   certData.putSerializable("cert", cert);
   msg.setData(certData);
   // if bound, send instantly, otherwise send notification and add to queue
   if (mIsBound) {
     try {
       mRemoteMessenger.send(msg);
     } catch (RemoteException ex) {
       Logger.getLogger(BackgroundService.class.getName()).log(Level.SEVERE, null, ex);
     }
   } else {
     Log.e(TAG, "*** Bad... i am not bound so i will save this message for later use...");
     mPendingMessages.add(msg);
     mNM.notify(
         CandisNotification.NOTIFICATION_ID,
         CandisNotification.getNotification(mContext, "Certificate authentification required"));
   }
   mTrusmanager = tm;
 }