Questions tagged [native-activity]

NativeActivity is a convenience class provided by the Android SDK that notifies native code of any activity lifecycle callbacks and makes it possible to write Android application without any Java code at all.

The Android SDK provides the NativeActivity class, which is a convenience class that notifies your native code of any activity lifecycle callbacks (onCreate(), onPause(), onResume(), etc). You can implement the callbacks in your native code to handle these events when they occur. Applications that use native activities must be run on Android 2.3 (API Level 9) or later. You cannot access features such as Services and Content Providers natively, so if you want to use them or any other framework API, you can still write JNI code to do so.

http://developer.android.com/sdk/ndk/overview.html

http://developer.android.com/reference/android/app/NativeActivity.html

132 questions
2
votes
0 answers

Do I have to free the memory that I have allocated when android_main() returns?

I'm using NativeActivity and android_native_app_glue.c/h and the android_main function on the c++ side. I just learned that when the app is completely destroyed (APP_CMD_DESTROY event is generated), the Linux process of the app is still NOT…
kynnysmatto
  • 3,665
  • 23
  • 29
2
votes
1 answer

Loading shared object dynamically which is in the APK libs folder

hope you can help me here. I managed to create my native activity project and packaged it. In the libs folder I have a shared library that is loaded dynamically (dlopen) within the native activity. I know that the package libs are copied into:…
yaakuro
  • 191
  • 1
  • 4
2
votes
1 answer

"No implementation found for" using NativeActivity

I have a project that I am working on that uses a NativeActivity, along with the android_native_app_glue files to connect to the Java side. I need to access a few non NDK classes through Java and have figured out how to make the calls from C to…
2
votes
1 answer

Checking if directory (folder) exists in apk via native code only

I need to check wether a certain directory exists in apk. The android/asset_manager.h api seems to be inconsistent - it returns NULL when AAsset* AAssetManager_open(AAssetManager* mgr, const char* filename, int mode); fails to open a file, but for…
pdeschain
  • 1,411
  • 12
  • 21
2
votes
0 answers

android window created not taking into account status bar

I'm using the NativeActivity for Android, and when my window creates I call: ANativeWindow_setBuffersGeometry(g_AndroidEngine.app->window, 0, 0, format); When I check the size of the window that gets created, it is created under the status bar. So…
2
votes
1 answer

Why native Android application restarts immediately after crashing?

I have a single-activity native application which uses the NativeActivity class. If the application crashes it is restarted immediately. I have been searching the Internet the whole day for this problem. This happens when using any of the following…
Devenec
  • 163
  • 1
  • 11
2
votes
1 answer

How to make networked software aware of itself?

I have an Android and iOS app that I would like to be accessible through PC software. Currently, the mobile application will display an IP address and the PC user must manually type this number in to create a connection. I know there is some sort…
Mike Weir
  • 3,094
  • 1
  • 30
  • 46
2
votes
1 answer

Android "WIN DEATH" without warning

I get the following statements from logcat, just after some successful log statements indicating my application is doing just fine (stat output, etc...): I/WindowState( 425): WIN DEATH: Window{4244e028 u0…
Mike Weir
  • 3,094
  • 1
  • 30
  • 46
2
votes
0 answers

Android disable screen dimming in NativeActivity

I need to disable/enable screen dimming from NativeActivity (when rendering is performed by OpenGL). I have inherited MyNativeActivity: public class MyNativeActivity extends NativeActivity { public final void disableAutoSleep() { …
Nick
  • 3,205
  • 9
  • 57
  • 108
2
votes
0 answers

NDK NativeActivity on top of JavaApplication with WebView?

I am looking for a way to have part of my OpenGL NativeActivity transparent on top of a Java application with a web view so I can have a browser in my application. Porting the WebKit is problematic and taking more time than I have. Does any one know…
ShadowCode
  • 111
  • 1
  • 3
2
votes
2 answers

Handle main commands in android native activity

In android native activity you can handle main commands from system in your own method. I know how to do this, but i dont know what all states i can handle. I know few states like APP_CMD_SAVE_STATE, APP_CMD_INIT_WINDOW... but that´s not all. I cant…
InflexCZE
  • 722
  • 1
  • 14
  • 30
1
vote
0 answers

How to stop all native threads when Android app is backgrounded?

My video game is based on NativeActivity and has a lot of C++ threads. I'd like all those threads to pause like they do on iOS when my app is backgrounded. There are simply too many threads to chase them all down at random times. Does Android…
Bungles
  • 1,969
  • 2
  • 25
  • 54
1
vote
2 answers

Running each instance of an Activity in its own process?

I have a big chunk of third-party native code that I'm running on Android using the NDK. This code contains global variables, and as such only supports a single session per process. (Unless Android has some magic way of loading multiple instances of…
David Given
  • 13,277
  • 9
  • 76
  • 123
1
vote
1 answer

Creating Android WebView in NativeActivity with JNI in rust

I'm trying to connect a android.webkit.WebView object to a NativeActivity, but I'm failing simply trying to create the WebView object. That code looks like this #[cfg(target_os = "android")] pub fn setup(ctx: AndroidContext, env: AttachGuard) ->…
1
vote
0 answers

Unable to find custom java class from jar into a Android Native-Activity app

I'm working on an Android Native-Activity application with Visual Studio, starting from scratch (I'm trying to make it work in a basic test app first). It uses Ant to build the apk. In my native code, I need to call a custom java method (not java…
sebseb24
  • 310
  • 2
  • 11
1 2 3
8 9