use proper flags for ANDROID, pass url to C++

This commit is contained in:
Stephen Birarda 2015-01-29 14:13:10 -08:00
parent dc866b62e4
commit 2657af8d4b
3 changed files with 20 additions and 4 deletions

View file

@ -9,7 +9,9 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifdef Q_WS_ANDROID
#ifdef ANDROID
#include <jni.h>
#include <QtAndroidExtras/QAndroidJniEnvironment>
#include <QtAndroidExtras/QAndroidJniObject>
@ -58,8 +60,20 @@ GVRInterface::GVRInterface(int argc, char* argv[]) :
idleTimer->start(0);
}
#ifdef ANDROID
extern "C" {
JNIEXPORT void Java_io_highfidelity_gvrinterface_InterfaceActivity_handleHifiURL(JNIEnv *jni, jclass clazz, jstring hifiURLString) {
qDebug() << "The lookup string in c++ is" << QAndroidJniObject(hifiURLString).toString();
}
}
#endif
void GVRInterface::idle() {
#if defined(Q_WS_ANDROID) && defined(HAVE_LIBOVR)
#if defined(ANDROID) && defined(HAVE_LIBOVR)
if (!_inVRMode && ovr_IsHeadsetDocked()) {
qDebug() << "The headset just got docked - assume we are in VR mode.";
_inVRMode = true;

View file

@ -29,7 +29,7 @@ GVRMainWindow::GVRMainWindow(QWidget* parent) :
QMainWindow(parent)
{
#ifndef Q_OS_ANDROID
#ifndef ANDROID
const int NOTE_4_WIDTH = 2560;
const int NOTE_4_HEIGHT = 1440;
setFixedSize(NOTE_4_WIDTH / 2, NOTE_4_HEIGHT / 2);

View file

@ -20,6 +20,8 @@ import org.qtproject.qt5.android.bindings.QtActivity;
public class InterfaceActivity extends QtActivity {
public static native void handleHifiURL(String hifiURLString);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -31,7 +33,7 @@ public class InterfaceActivity extends QtActivity {
Uri data = intent.getData();
if (data.getScheme().equals("hifi")) {
handleHifiURL(data.toString());
}
}