adding and testing command line parameter passing to application

This commit is contained in:
amer cerkic 2019-02-27 11:42:22 -08:00
parent 19d584f0af
commit 92cfa49bfb
5 changed files with 46 additions and 6 deletions

View file

@ -28,7 +28,7 @@
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.INFO" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity

View file

@ -1,12 +1,27 @@
package io.highfidelity.questInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import io.highfidelity.oculus.OculusMobileActivity;
import io.highfidelity.utils.HifiUtils;
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
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());
super.onCreate(savedInstanceState);
}

View file

@ -5,6 +5,7 @@ import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.text.TextUtils;
import io.highfidelity.oculus.OculusMobileActivity;
import io.highfidelity.utils.HifiUtils;
@ -19,9 +20,16 @@ public class PermissionsChecker extends Activity {
Manifest.permission.CAMERA
};
private static final String EXTRA_ARGS = "args";
private String mArgs;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mArgs =(getIntent().getStringExtra(EXTRA_ARGS));
System.out.println("QQQ_ launched args: "+mArgs);
requestAppPermissions(REQUIRED_PERMISSIONS,REQUEST_PERMISSIONS);
}
@ -47,7 +55,13 @@ public class PermissionsChecker extends Activity {
}
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();
}

View file

@ -39,6 +39,17 @@ public class OculusMobileActivity extends QtActivity implements SurfaceHolder.Ca
private SurfaceHolder mSurfaceHolder;
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);
Log.w(TAG, "QQQ onCreate");

View file

@ -2419,8 +2419,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
pauseUntilLoginDetermined();
#if defined(Q_OS_ANDROID)
const QString QUEST_DEV = "hifi://quest-dev";
DependencyManager::get<AddressManager>()->handleLookupString(QUEST_DEV);
// / const QString QUEST_DEV = "hifi://quest-dev";
// DependencyManager::get<AddressManager>()->handleLookupString(QUEST_DEV);
#endif
}
@ -3669,8 +3669,8 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
// If this is a first run we short-circuit the address passed in
if (_firstRun.get()) {
#if !defined(Q_OS_ANDROID)
DependencyManager::get<AddressManager>()->goToEntry();
sentTo = SENT_TO_ENTRY;
// DependencyManager::get<AddressManager>()->goToEntry();
// sentTo = SENT_TO_ENTRY;
#endif
_firstRun.set(false);