android / android/ndk

C++ Wrapper for BroadcastReceiver

Open
#1,488 4 comments 2 reactions 0 assignees View on GitHub
c++ wrapper request enhancement
Dominant language
No language data
Stars
2.3k
Forks
310
PR merge metrics
No merged PRs in 30d

Description

BroadcastReceiver's [onReceive method](https://developer.android.com/reference/android/content/BroadcastReceiver?hl=en#onReceive(android.content.Context,%20android.content.Intent)) is used to receive broadcast Intents after [registration for them](https://developer.android.com/reference/android/content/Context?hl=en#registerReceiver(android.content.BroadcastReceiver,%20android.content.IntentFilter)), but the method is abstract.

It appears that, presently, one needs a Java class to receive broadcast Intents (that it can't be done through JNI), although I am not certain of this. It would be great if there were a way to receive broadcast Intents from native code.

Note that adding [java.beans.EventHandler](https://docs.oracle.com/javase/7/docs/api/java/beans/EventHandler.html) to the Android API might provide for more workarounds to things like this, not certain.

Contributor guide

Open the contributing guide

Research direction

Start with the linked BroadcastReceiver.onReceive and Context.registerReceiver documentation, then investigate whether JNI can expose broadcast reception to native code without a Java receiver. Done would require a clearly supported native approach or a documented conclusion that the request needs a broader Android API design.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cpp
Domain
mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.