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
3
votes
0 answers

Making a NativeActivity behave like a Service

I have an application, mostly written in native code, based around NativeActivity. Mostly this runs as a full-screen activity, and it works fine like this. But for one specific use case I need to be able to run it in the background, headless,…
David Given
  • 13,277
  • 9
  • 76
  • 123
3
votes
0 answers

Visual Studio can only select android-25 target API for native activity packaging project

I have two issues that I don't really understand: The visual studio installer only lets you select android-25 or android-31, Where are the rest of them? Even with 31 installed, the native activity packaging application only lets you select…
Fries of Doom
  • 159
  • 1
  • 5
3
votes
1 answer

How do I write to the internal storage file system with NativeActivity?

I'm porting a pure C++ game over to Android, and since my target is Android 3.0+ tablets, I opted to use NativeActivity in order to avoid Java completely. However, I am not able to see any functionality that lets me write to the device's internal…
3
votes
1 answer

How can I prevent stalling of code in my android jni calls?

I am porting over an application that has been written already in C++ to run on Linux that now needs to run on an Android device. It is a GPU intensive app that makes OpenCL calls, running a set of tests. These could take up to several hours or days…
3
votes
1 answer

Is it necessary to call system.loadLibrary explicitly for accessing the native methods in a NativeActivity sub class?

I have an Android app with an activity derived from NativeActivity like this: public class MyNativeActivity extends android.app.NativeActivity { public native void TellNativeSide(int info); static { System.loadLibrary("MyNatAct"); …
Nibikibaba
  • 310
  • 2
  • 10
3
votes
0 answers

Implementing IPC using Binder from C/C++

I have an Android App that is fully written in C. I'd like to be able to implement IPC natively, i.e. - not come back up to Java via JNI if possible. I have read that since the Binder APIs are not part of the NDK APIs, I should not use it…
Sofia Clover
  • 669
  • 1
  • 7
  • 18
3
votes
1 answer

Unified access to files from native code

My application has two sources of data: standard assets folder and downloaded file. Now I access assets (from C++ code) using AAssetManager_open, AAsset_read etc. And I read data from downloaded file using good old fopen, fread etc. Is it possible…
Nick
  • 3,205
  • 9
  • 57
  • 108
3
votes
3 answers

Native Activity OpenCV4Android doesn't work

I have downloaded the latest version of OpenCV4Android, the 2.4.5 version, and imported it into Eclipse Juno, after downloading all the right plugins. All the tutorials work well on my Android emulator, except Native Activity. When I try to run it…
user2307515
3
votes
1 answer

How to deal with the LOCAL_STATIC_LIBRARIES in android .mk

I'm trying to port one of the android NDK samples (native-activity) to work with the vs-android plugging that lets me develop in MVS. To do this I need to translate the Android.mk commands into something MVS can deal with, and I'm having trouble…
JaimeBarrachina
  • 430
  • 8
  • 21
3
votes
3 answers

OpenCV2.4 with Android Native Activity

I am currently facing the same problem than presented in this question, except that I use the 2.4 version in stead of the 2.3.1. I've converted native-activity (from ndk samples) to c++ and modified android.mk and application.mk. I had the same…
Tonial
  • 73
  • 3
  • 6
2
votes
1 answer

Is there a way to declare several native activities in android manifest?

I need to create 2 native activities in my android app where one activity will be communicating with another. I would like to avoid java coding involved, there is a way to do that if activity name is set…
2
votes
2 answers

glCreateShader() crashes on Android 11 / Pixel 5

I have a NativeActivity program which works fine on a OnePlus 3T running Android 9. It crashes on startup in Android 11 running on a Pixel 5. I'm using Visual Studio 2019 and SDK Build-tools 29.0.2 and Platform-Tools 30.0.4. The AndroidManifest.xml…
Jon Watte
  • 6,579
  • 4
  • 53
  • 63
2
votes
0 answers

Android sws_scale RGB0 Frame taking long time and cause video latency

Reading frames from FFMPEG and try to directly draw on a surface window in Native android, If scale the image to exact size what we are getting from the camera and apply YUV420P to RGBA it take 1ms to scale through av_image_fill_arrays but if scale…
AJit
  • 1,283
  • 1
  • 13
  • 34
2
votes
2 answers

Using ARCore 1.1.0 with NativeActivity and building with other IDE (Visual Studio 2015/2017)

I'm still trying to use ARCore for a native Android app in another IDE (Visual Studio) instead of Android Studio. That's why I need to "DIY" numbers of things (like manually add ARCore dependency in my APK package). So far I made some progress but…
Hongkun Wang
  • 717
  • 8
  • 22
2
votes
1 answer

Using fragments with NativeActivity

I have a fully working C++/OpenGL engine that I ported over to Android using their supplied NativeActivity. But I'm now tasked with integrating it to an older project which was 100% Java, with plenty of Fragments. My question is simple : Is it…
dZbear
  • 31
  • 5
1 2
3
8 9