ksksue / PhysicaloidLibrary

Android Library for communicating with physical-computing boards (e.g.Arduino, mbed)
http://www.physicaloid.com/
357 stars 151 forks source link

Automatically disable all debug when doing a release #5

Closed Lauszus closed 11 years ago

ksksue commented 11 years ago

It's a good method. Thanks.

Lauszus commented 11 years ago

You are welcome :)

I briefly looked into adding onPermissionAllowed/onPermissionDenied callback methods, as we discussed here: https://github.com/ksksue/PhysicaloidLibrary/pull/3#issuecomment-24555328, but I couldn't get it working. Did you ever look into it?

Lauszus commented 11 years ago

Also is it possible to cancel a upload? Right now when a user try to close my app it will simply wait until the upload is completed and then close the app.

ksksue commented 11 years ago

Can't you solve the permission problem by listing a USB VID on the device-filter.xml? http://stackoverflow.com/questions/15255524/android-usb-device-permission-and-intent-filter

Canceling a upload is not supported now but I'll try to implement.

Lauszus commented 11 years ago

I tried that already: https://github.com/TKJElectronics/BalanduinoAndroidApp/commit/7a227d06b843312b48e4789eddbf9ffd8bf4d5bc, but it doesn't work, as it will then open a instance of the app on top of the previous one if you plug in the board to the USB host port. There is the same problem when using it with a USB accessory (I use both in my app). Maybe I should fill in a bug report: https://code.google.com/p/android/issues/list?

Okay thanks!

ksksue commented 11 years ago

I have done the solution on stackoverflow, it seems OK. It doesn't popup the permission dialog again. https://github.com/ksksue/Android-USB-Serial-Monitor-Lite (It's newest version. Google Play's apk is still old version.)

Lauszus commented 11 years ago

You misunderstood me. The problem is that when you plug the board in and out it will reopen the app even if it's already running.

ksksue commented 11 years ago

You mean running double application? You might set this in AndroidManifest.xml android:launchMode="singleTask"

ksksue commented 11 years ago

It should be written on "activity" tag option in AndroidManifest.xml

Lauszus commented 11 years ago

I do that already: https://github.com/TKJElectronics/BalanduinoAndroidApp/blob/master/AndroidManifest.xml#L2.

I actually just tried it one more time and it looks like it must have been related to something else. Thanks anyway!

ksksue commented 11 years ago

"manifest" has no android:launchMode option. http://developer.android.com/guide/topics/manifest/manifest-element.html It should be written on "activity" option. http://developer.android.com/guide/topics/manifest/activity-element.html

Lauszus commented 11 years ago

Thank you! That is properly why I had problems!

ksksue commented 11 years ago

You are welcome.

ksksue commented 11 years ago

I implemented cancel() and onCancel() callback methods.

Lauszus commented 11 years ago

Thank you!

Would you be able to implement isUploading as well? It is pretty easy for me to keep track of it. See: https://github.com/TKJElectronics/BalanduinoAndroidApp/blob/master/flavors/usb/src/com/tkjelectronics/balanduino/Upload.java#L59, but I think it would be great to have as part of the library instead.