spaaarky21
spaaarky21

Reputation: 6858

Launch app with environment variable

I'm writing a C/C++ Android app. One of the libraries I'm using prints additional debugging information depending on whether an environment variable is set. Is there's any way to set one?

I was hoping that the launch target could be configured with an environment variable in Android Studio. Under Launch Options, there's an option to provide flags to the am start call but Activity Manager doesn't provide any way of setting an environment variable prior to launch.

Upvotes: 4

Views: 2937

Answers (1)

Dan Albert
Dan Albert

Reputation: 10499

Include a wrap.sh file in your APK: https://developer.android.com/ndk/guides/wrap-script.html

This only works for debuggable APKs, but given that you want it for logging that's probably for the best anyway.

Upvotes: 5

Related Questions