Closed ghost closed 9 years ago
Try to use an other interface like callback or Asynctask factory.
Can you maybe show an example using AsyncTask Factory. From the docs i dont get a clear idea how to implement it. In this case im sending a signal from phone to wear to start an activity. But when im debugging and i try to restart the app multiple times from the phone i get the message that the task is allready running and the app crashes.
Did you read this ? https://github.com/Mariuxtheone/Teleport/blob/master/doc/ADVANCEDUSAGE.md
I have looked at it but i'm only a beginner when it comes to android development, and don't really know how to implement it. When i try to launch an activity, i send a message using "sendMessage". On the wear side i have a teleport service running that checks whether the message is equal to a keyword and executes the activity. How do i implement the Async Factory builder? Do i have to make some modifications on in the service or use a different approach to starting an activity?
Try with callbacks first. It's easier.
Le lun. 30 mars 2015 10:19, Suraj notifications@github.com a écrit :
I have looked at it but i'm only a beginner when it comes to android development, and don't really know how to implement it. When i try to launch an activity, i send a message using "sendMessage". On the wear side i have a teleport service running that checks whether the message is equal to a keyword and executes the activity. How do i implement the Async Factory builder? Do i have to make some modifications on in the service or use a different approach to starting an activity?
— Reply to this email directly or view it on GitHub https://github.com/Mariuxtheone/Teleport/issues/23#issuecomment-87588003 .
Thanks for your suggestion! I made some modifications, it seemed to have worked. No issues so far. Thank you!
Im trying to send sensor data as a string using the sendMessage method. For 2 sensors it worked fine, but when adding for 5 sensors types, i get this runtime error. I doesnt allow me to make any changes when trying to compile. When running the sensor collector on the wearable it keeps on getting the data but it also displays this runtime error. So it does work, but i dont know how to deal with this error.
03-11 11:12:15.280 31002-31265/example.com.test W/Binder﹕ Caught a RuntimeException from the binder stub implementation. java.lang.IllegalStateException: Cannot execute task: the task is already running. at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:576) at android.os.AsyncTask.execute(AsyncTask.java:535) at com.mariux.teleport.lib.TeleportClient.onMessageReceived(TeleportClient.java:338) at com.google.android.gms.wearable.internal.bb.a(Unknown Source) at com.google.android.gms.wearable.internal.ae$a.onTransact(Unknown Source) at android.os.Binder.execTransact(Binder.java:404) at dalvik.system.NativeStart.run(Native Method) 03-11 11:12:15.300 31002-31021/example.com.aflgesturerecognition D/TeleportClient﹕ onMessageReceived() A message from watch was received:1640 ACCELEROMETER;4238107025104;0.07562256;-0.08029175;9.89003; 03-11 11:12:15.310 31002-31260/example.com.test D/TeleportClient﹕ onMessageReceived() A message from watch was received:1641 GYROSCOPE;0.0025939941;-5.0354004E-4;-4.4250488E-4; 03-11 11:12:15.330 31002-31013/example.com.test D/TeleportClient﹕ onMessageReceived() A message from watch was received:1642 GRAVITY;4238107025104;0.04632878;-0.035488866;9.806477; 03-11 11:12:15.340 31002-31014/example.com.test D/TeleportClient﹕ onMessageReceived() A message from watch was received:1643 LINEAR_ACCELERATION;0.029006232;-0.044582613;0.022687912; 03-11 11:12:15.370 31002-31014/example.com.test D/TeleportClient﹕ onMessageReceived() A message from watch was received:1644 ROTATION_VECTOR;-0.0018040044;-0.002366272;0.0022976713; 03-11 11:12:15.370 31002-31260/example.com.test D/TeleportClient﹕ onMessageReceived() A message from watch was received:1645 ACCELEROMETER;4238111663776;0.05419922;-0.027923584;9.89003; 03-11 11:12:15.370 31002-31260/example.com.test W/Binder﹕ Caught a RuntimeException from the binder stub implementation. java.lang.IllegalStateException: Cannot execute task: the task is already running. at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:576) at android.os.AsyncTask.execute(AsyncTask.java:535) at com.mariux.teleport.lib.TeleportClient.onMessageReceived(TeleportClient.java:338) at com.google.android.gms.wearable.internal.bb.a(Unknown Source) at com.google.android.gms.wearable.internal.ae$a.onTransact(Unknown Source) at android.os.Binder.execTransact(Binder.java:404) at dalvik.system.NativeStart.run(Native Method)