How to use AppCompatActivity with NativeActivity?

146 views
Skip to first unread message

jonlgre...@gmail.com

unread,
Mar 14, 2024, 8:22:02 PMMar 14
to android-ndk
I am writing a C++ app based on NativeActivity. I have various functions implemented in java using JNI. At API 33 I need to invoke a request to allow posting of notifications, as described in Request runtime permissions. But this requires my app to extend AppCompatActivity, rather than Activity.
I am using NativeActivity which extends Activity, not AppCompatActivity. Is there any way to do this, or is NativeActivity broken and unusable for API 33?



mic _

unread,
Mar 15, 2024, 6:24:33 AMMar 15
to andro...@googlegroups.com
These methods are all available in the regular Activity class as far as I can tell:

checkSelfPermission
shouldShowRequestPermissionRationale
requestPermissions

onRequestPermissionsResult

Wouldn't those be sufficient for you to be able to handle permissions in your app?


On Fri, Mar 15, 2024 at 1:22 AM jonlgre...@gmail.com <jonlgre...@gmail.com> wrote:
I am writing a C++ app based on NativeActivity. I have various functions implemented in java using JNI. At API 33 I need to invoke a request to allow posting of notifications, as described in Request runtime permissions. But this requires my app to extend AppCompatActivity, rather than Activity.
I am using NativeActivity which extends Activity, not AppCompatActivity. Is there any way to do this, or is NativeActivity broken and unusable for API 33?



--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/dd0f0509-abee-4b17-8028-0ad200f9022fn%40googlegroups.com.

jonlgre...@gmail.com

unread,
Mar 15, 2024, 10:45:59 AMMar 15
to android-ndk
Thanks, I guess they may be. But the documented description of how to request permissions from API 33 requires using AppCompatActivity. Clearly that is the direction in which development is going. So the question about how to integrate AppCompatActivity into a NativeActivity still stands. Are we moving to a situation in which we should not be using the SDK NativeActivity class? Is it just not being developed any more, and expected to fall into disuse? If so, can Google provide a suitable sample that works going forward without it for native apps?
Reply all
Reply to author
Forward
0 new messages