| | |
| | | Log.i(TAG,"onCreate()"); |
| | | speaker = new Speaker(getApplicationContext()); |
| | | |
| | | startNative(); |
| | | new Thread(new StartNative()).start(); |
| | | } |
| | | |
| | | class StartNative implements Runnable { |
| | | @Override |
| | | public void run() { |
| | | startNative(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | mIsServiceDestroyed.set(true); |
| | | } |
| | | |
| | | private void onMessageArrived(int cmd, String json){ |
| | | private void onMessageArrived(int cmd, String json) { |
| | | int N = mListenerList.getRegisteredCallbackCount(); |
| | | |
| | | mListenerList.beginBroadcast(); |
| | | |
| | | for (int i = 0; i < N; i++) { |
| | | mListener = mListenerList.getBroadcastItem(i); |
| | | if (mListener != null){ |
| | | try { |
| | | mListener.onMessageArrived(cmd, json); |
| | | } catch (RemoteException e) { |
| | | e.printStackTrace(); |
| | | synchronized(this) { |
| | | mListenerList.beginBroadcast(); |
| | | for (int i = 0; i < N; i++) { |
| | | mListener = mListenerList.getBroadcastItem(i); |
| | | if (mListener != null) { |
| | | try { |
| | | mListener.onMessageArrived(cmd, json); |
| | | } catch (RemoteException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | mListenerList.finishBroadcast(); |
| | | } |
| | | mListenerList.finishBroadcast(); |
| | | } |
| | | |
| | | public void SendMsgToMainProc(int cmd, String value) { |