aboutsummaryrefslogtreecommitdiffstats
path: root/android-mobile
diff options
context:
space:
mode:
Diffstat (limited to 'android-mobile')
-rw-r--r--android-mobile/src/org/subsurfacedivelog/mobile/SubsurfaceMobileActivity.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/android-mobile/src/org/subsurfacedivelog/mobile/SubsurfaceMobileActivity.java b/android-mobile/src/org/subsurfacedivelog/mobile/SubsurfaceMobileActivity.java
index c909210f2..52f401b71 100644
--- a/android-mobile/src/org/subsurfacedivelog/mobile/SubsurfaceMobileActivity.java
+++ b/android-mobile/src/org/subsurfacedivelog/mobile/SubsurfaceMobileActivity.java
@@ -50,6 +50,11 @@ public class SubsurfaceMobileActivity extends QtActivity
isIntentPending = true;
}
}
+
+ // Register the usb permission intent filter.
+ IntentFilter filter = new IntentFilter("org.subsurfacedivelog.mobile.USB_PERMISSION");
+ registerReceiver(usbReceiver, filter);
+
} // onCreate
// if we are opened from other apps:
@@ -104,6 +109,23 @@ public class SubsurfaceMobileActivity extends QtActivity
} // processIntent
+ private final BroadcastReceiver usbReceiver = new BroadcastReceiver() {
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ if ("org.subsurfacedivelog.mobile.USB_PERMISSION".equals(action)) {
+ synchronized (this) {
+ if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) {
+ Log.d(TAG, "USB device permission granted");
+ // Stub: press the download button here :)
+ }
+ else {
+ Log.d(TAG, "USB device permission granted");
+ }
+ }
+ }
+ }
+ };
+
public static Context getAppContext()
{
return appContext;