Android: only handle Intents after the app is initialized

The old code happened to work because this function only got called if
the app was already running, but the correct thing to do is to always
wait until we have first called back from C++ code, indicating that the
app is indeed fully initialized.

This way we only process the Intent in one place in the Java code.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-08-09 07:14:56 -07:00
parent fbf94d4a7b
commit fd58441b08

View file

@ -53,13 +53,7 @@ public class SubsurfaceMobileActivity extends QtActivity
public void onNewIntent(Intent intent) {
Log.i(TAG + " onNewIntent", intent.getAction());
UsbDevice device = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
Log.i(TAG + " onNewIntent device name", device.getDeviceName());
// if (Build.VERSION.SDK_INT > 20) {
// Log.i(TAG + " onNewIntent manufacturer name", device.getManufacturerName());
// Log.i(TAG + " onNewIntent product name", device.getProductName());
// }
Log.i(TAG + " onNewIntent toString", device.toString());
setDeviceString(device.toString());
super.onNewIntent(intent);
setIntent(intent);
// Intent will be processed, if all is initialized and Qt / QML can handle the event
@ -88,10 +82,6 @@ public class SubsurfaceMobileActivity extends QtActivity
Log.i(TAG + " processIntent", intent.getAction());
UsbDevice device = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
Log.i(TAG + " processIntent device name", device.getDeviceName());
// if (Build.VERSION.SDK_INT > 20) {
// Log.i(TAG + " processIntent manufacturer name", device.getManufacturerName());
// Log.i(TAG + " processIntent product name", device.getProductName());
// }
Log.i(TAG + " processIntent toString", device.toString());
setDeviceString(device.toString());
} // processIntent
}