| | |
| | | |
| | | import com.anyun.exam.lib.util.DESUtil; |
| | | import com.anyun.exam.lib.util.NetUtils; |
| | | import com.anyun.exam.lib.util.Speaker; |
| | | |
| | | import androidx.annotation.Nullable; |
| | | |
| | |
| | | private RemoteCallbackList<IListenerInterface> mListenerList = new RemoteCallbackList(); |
| | | private IListenerInterface mListener; |
| | | private int msgId = 0; |
| | | private Speaker speaker = null; |
| | | |
| | | private IRemoteInterface.Stub iRemoteInterface = new IRemoteInterface.Stub(){ |
| | | @Override |
| | | public void registListener(IListenerInterface i) throws RemoteException { |
| | |
| | | public void onCreate() { |
| | | super.onCreate(); |
| | | Log.i(TAG,"onCreate()"); |
| | | speaker = new Speaker(getApplicationContext()); |
| | | |
| | | startNative(); |
| | | new Thread(new Worker()).start(); |
| | | } |
| | |
| | | public void run() { |
| | | while (!mIsServiceDestroyed.get()){ |
| | | try { |
| | | Thread.sleep(4*1000); |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | |
| | | private void onMessageArrived(String json){ |
| | | int N = mListenerList.getRegisteredCallbackCount(); |
| | | |
| | | Log.d(TAG, "getRegisteredCallbackCount = " + N); |
| | | mListenerList.beginBroadcast(); |
| | | |
| | | for (int i = 0; i < N; i++) { |
| | | mListenerList.beginBroadcast(); |
| | | |
| | | mListener = mListenerList.getBroadcastItem(i); |
| | | if (mListener != null){ |
| | | try { |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | mListenerList.finishBroadcast(); |
| | | |
| | | } |
| | | mListenerList.finishBroadcast(); |
| | | } |
| | | |
| | | public String javaGetImei() { |
| | |
| | | } |
| | | |
| | | public void TextSpeak(String text) { |
| | | /* if (speaker != null) { |
| | | if (speaker != null) { |
| | | speaker.speak(text); |
| | | }*/ |
| | | } |
| | | } |
| | | |
| | | // Used to load the 'native-lib' library on application startup. |