$ adb shell am start -n com.sec.dalidemo/.DaliDemoNativeActivity --es start "benchmark.example"
+Optional arguments can be added while launching the demo. For example:
+
+ $ adb shell 'am start -n com.sec.dalidemo/.DaliDemoNativeActivity --es start "benchmark.example" --es arguments "-r40 -c40"'
+
## 4. Building for MS Windows
Third party dependencies are built using vcpkg. Instructions on how to install vcpkg can be found in the
android:value="native-activity" />
<meta-data android:name="start"
android:value="blocks.example" />
+ <meta-data android:name="arguments"
+ android:value="" />
<intent-filter>
<action android:name="android.intent.action.RUN" />
</intent-filter>
android:value="native-activity" />
<meta-data android:name="start"
android:value="dali-demo" />
+ <meta-data android:name="arguments"
+ android:value="" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
android:value="native-activity" />
<meta-data android:name="start"
android:value="dali-examples" />
+ <meta-data android:name="arguments"
+ android:value="" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
android:value="native-activity" />
<meta-data android:name="start"
android:value="dali-tests" />
+ <meta-data android:name="arguments"
+ android:value="" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
dlerror(); /* Clear any existing error */
+ std::string argumentsParam = nativeActivity.GetIntentStringExtra("arguments");
+ if(argumentsParam.empty())
+ {
+ argumentsParam = nativeActivity.GetMetaData("arguments");
+ }
+
int (*main)(int, char**) = (int (*)(int, char**))dlsym(handle, "main");
LOGV("lib=%s handle=%p main=%p", libpath.c_str(), handle, main);
if(main)
{
- status = main(0, nullptr);
+ if(!argumentsParam.empty())
+ {
+ // Tokenize `arguments` string into argc and argv
+ std::vector<std::string> argTokens;
+ std::istringstream iss(argumentsParam);
+ std::string token;
+ while(iss >> token)
+ {
+ argTokens.push_back(token);
+ }
+
+ // Convert to char** argv
+ std::vector<char*> argv;
+ for(std::string& arg : argTokens)
+ {
+ argv.push_back(const_cast<char*>(arg.c_str()));
+ }
+
+ status = main(static_cast<int>(argv.size()), argv.empty() ? nullptr : argv.data());
+ }
+ else
+ {
+ status = main(0, nullptr);
+ }
}
else
{