mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:07:58 +02:00
adding and testing command line parameter passing to application
This commit is contained in:
parent
19d584f0af
commit
92cfa49bfb
5 changed files with 46 additions and 6 deletions
|
@ -28,7 +28,7 @@
|
||||||
android:excludeFromRecents="true">
|
android:excludeFromRecents="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.INFO" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
|
|
|
@ -1,12 +1,27 @@
|
||||||
package io.highfidelity.questInterface;
|
package io.highfidelity.questInterface;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import io.highfidelity.oculus.OculusMobileActivity;
|
import io.highfidelity.oculus.OculusMobileActivity;
|
||||||
import io.highfidelity.utils.HifiUtils;
|
import io.highfidelity.utils.HifiUtils;
|
||||||
|
|
||||||
public class InterfaceActivity extends OculusMobileActivity {
|
public class InterfaceActivity extends OculusMobileActivity {
|
||||||
|
public static final String DOMAIN_URL = "url";
|
||||||
|
private static final String TAG = "Interface";
|
||||||
|
public static final String EXTRA_ARGS = "args";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
if(this.getIntent().hasExtra("applicationArguments")){
|
||||||
|
System.out.println("QQQ_ InterfaceActivity: args EXISTS");
|
||||||
|
System.out.println("QQQ_ "+ this.getIntent().getStringExtra("applicationArguments"));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
System.out.println("QQQ_ InterfaceActivity: NO argmument");
|
||||||
|
}
|
||||||
|
|
||||||
HifiUtils.upackAssets(getAssets(), getCacheDir().getAbsolutePath());
|
HifiUtils.upackAssets(getAssets(), getCacheDir().getAbsolutePath());
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import io.highfidelity.oculus.OculusMobileActivity;
|
import io.highfidelity.oculus.OculusMobileActivity;
|
||||||
import io.highfidelity.utils.HifiUtils;
|
import io.highfidelity.utils.HifiUtils;
|
||||||
|
@ -19,9 +20,16 @@ public class PermissionsChecker extends Activity {
|
||||||
Manifest.permission.CAMERA
|
Manifest.permission.CAMERA
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static final String EXTRA_ARGS = "args";
|
||||||
|
private String mArgs;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
mArgs =(getIntent().getStringExtra(EXTRA_ARGS));
|
||||||
|
|
||||||
|
System.out.println("QQQ_ launched args: "+mArgs);
|
||||||
requestAppPermissions(REQUIRED_PERMISSIONS,REQUEST_PERMISSIONS);
|
requestAppPermissions(REQUIRED_PERMISSIONS,REQUEST_PERMISSIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +55,13 @@ public class PermissionsChecker extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchActivityWithPermissions() {
|
private void launchActivityWithPermissions() {
|
||||||
startActivity(new Intent(this, InterfaceActivity.class));
|
Intent intent= new Intent(this, InterfaceActivity.class);
|
||||||
|
|
||||||
|
if(!TextUtils.isEmpty(mArgs)) {
|
||||||
|
intent.putExtra("applicationArguments", mArgs);
|
||||||
|
}
|
||||||
|
|
||||||
|
startActivity(intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,17 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
|
||||||
private SurfaceHolder mSurfaceHolder;
|
private SurfaceHolder mSurfaceHolder;
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
if(this.getIntent().hasExtra("applicationArguments")){
|
||||||
|
System.out.println("QQQ_ OculusMobileActivity has arguments");
|
||||||
|
System.out.println("QQQ_ "+ this.getIntent().getStringExtra("applicationArguments"));
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
System.out.println("QQQ_ OculusMobileActivity has NO arguments");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
Log.w(TAG, "QQQ onCreate");
|
Log.w(TAG, "QQQ onCreate");
|
||||||
|
|
|
@ -2419,8 +2419,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
pauseUntilLoginDetermined();
|
pauseUntilLoginDetermined();
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
const QString QUEST_DEV = "hifi://quest-dev";
|
// / const QString QUEST_DEV = "hifi://quest-dev";
|
||||||
DependencyManager::get<AddressManager>()->handleLookupString(QUEST_DEV);
|
// DependencyManager::get<AddressManager>()->handleLookupString(QUEST_DEV);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3669,8 +3669,8 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
|
||||||
// If this is a first run we short-circuit the address passed in
|
// If this is a first run we short-circuit the address passed in
|
||||||
if (_firstRun.get()) {
|
if (_firstRun.get()) {
|
||||||
#if !defined(Q_OS_ANDROID)
|
#if !defined(Q_OS_ANDROID)
|
||||||
DependencyManager::get<AddressManager>()->goToEntry();
|
// DependencyManager::get<AddressManager>()->goToEntry();
|
||||||
sentTo = SENT_TO_ENTRY;
|
// sentTo = SENT_TO_ENTRY;
|
||||||
#endif
|
#endif
|
||||||
_firstRun.set(false);
|
_firstRun.set(false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue