Skip to content

Conversation

@johnny9
Copy link
Collaborator

@johnny9 johnny9 commented Apr 23, 2023

The AndroidNotifier class connects to the NodeModel's state signals and uses JNI to send callbacks to the Android service managing the foreground notification.

Windows
Intel macOS
Apple Silicon macOS
ARM64 Android

@johnny9 johnny9 force-pushed the jni-notifications branch 2 times, most recently from 6e0d079 to 1ef10e1 Compare April 23, 2023 21:29
@johnny9
Copy link
Collaborator Author

johnny9 commented Apr 23, 2023

from 6e0d079 to 1ef10e1

  • Fixed lint error
  • Made sure androidnotifier module is only compiled when targeting android using TARGET_ANDROID autotools conditional

@johnny9
Copy link
Collaborator Author

johnny9 commented Apr 24, 2023

paused notif.png

block height notif.png

connecting notif.png

@johnny9
Copy link
Collaborator Author

johnny9 commented Apr 24, 2023

@johnny9 johnny9 force-pushed the jni-notifications branch from 1ef10e1 to 90d250d Compare May 8, 2023 00:17
@johnny9
Copy link
Collaborator Author

johnny9 commented May 8, 2023

from 1ef10e1 to 90d250d

  • rebased with main

@hebasto
Copy link
Member

hebasto commented May 30, 2023

Needs rebase.

this, &AndroidNotifier::onBlockTipHeightChanged);
QObject::connect(&node_model, &NodeModel::numOutboundPeersChanged,
this, &AndroidNotifier::onNumOutboundPeersChanged);
QObject::connect(&node_model, &NodeModel::pauseChanged,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK, I've been running and testing this for a few days. The only issue I've noticed is that the "Paused" state won't be represented in the Notification if we were syncing before pressing paused. If we were connecting or any other state, it'll show. But not if we were syncing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What state does it show? I'm having a hard time reproducing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well now I also can't reproduce, may have just lagged in showing the update for whatever reason android decided.

notificationBuilder.setContentTitle("Connecting...");
} else if (!synced) {
if (verificationProgress < 0) {
notificationBuilder.setContentTitle(String.format("%.2f%% loaded...", verificationProgress));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnny9
Copy link
Collaborator Author

johnny9 commented May 31, 2023

Update from eb53a46 to acd2d3e:

  • rebased with main

The AndroidNotifier class connects to the NodeModel's state
signals and uses JNI to send callbacks to the Android service
managing the foreground notification.
@johnny9 johnny9 force-pushed the jni-notifications branch from acd2d3e to b641df4 Compare May 31, 2023 23:40
@johnny9
Copy link
Collaborator Author

johnny9 commented May 31, 2023

update from acd2d3e to b641df4:

  • fixed merge error on previous rebase. (#include qml/nodemodel.h to qml/models/nodemodel.h)

Copy link
Contributor

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approach ACK

I've been learning more about what we really need to do here in order to interact with the Android and the JVM, and this code is looking good here.

The androidnotifier.cpp file contains the importance pieces of magic. We're gaining access to the JVM and storing it. Then we're setting up the wiring between nodeModel updates to calls into our BitcoinQt Service to update the notification text.

@johnny9 are you able to reproduce this: https://github.com/bitcoin-core/gui-qml/pull/331/files#r1211573422

@jarolrod jarolrod assigned hebasto and unassigned hebasto Jun 2, 2023
@jarolrod jarolrod requested a review from hebasto June 2, 2023 19:22
Copy link
Contributor

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b641df4

@hebasto hebasto merged commit 23a1ab4 into bitcoin-core:main Jun 3, 2023
johnny9 pushed a commit to johnny9/bitcoin-core-app that referenced this pull request Jul 4, 2025
…droid notification

50c7340 android: use node model state to update notification (johnny9)

Pull request description:

  The AndroidNotifier class connects to the NodeModel's state signals and uses JNI to send callbacks to the Android service managing the foreground notification.

  [![Windows](https://img.shields.io/badge/OS-Windows-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/unsecure_win_gui.zip?branch=pull/331)
  [![Intel macOS](https://img.shields.io/badge/OS-Intel%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/unsecure_mac_gui.zip?branch=pull/331)
  [![Apple Silicon macOS](https://img.shields.io/badge/OS-Apple%20Silicon%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/unsecure_mac_arm64_gui.zip?branch=pull/331)
  [![ARM64 Android](https://img.shields.io/badge/OS-Android-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/unsecure_android_apk.zip?branch=pull/331)

ACKs for top commit:
  jarolrod:
    ACK 50c7340

Tree-SHA512: 1dfc95ade573f6620ba67871ff6f609e4bffe4cee877e03bd56c8917ac8cfb184198e5ca603ffda1962a3416da52921c0228eab5f0172011eca44de3d813e0d0
tx-signer450 added a commit to tx-signer450/gui-qml that referenced this pull request Oct 20, 2025
…droid notification

50c73409abb042fb20f00d803aee082981425398 android: use node model state to update notification (johnny9)

Pull request description:

  The AndroidNotifier class connects to the NodeModel's state signals and uses JNI to send callbacks to the Android service managing the foreground notification.

  [![Windows](https://img.shields.io/badge/OS-Windows-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/unsecure_win_gui.zip?branch=pull/331)
  [![Intel macOS](https://img.shields.io/badge/OS-Intel%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/unsecure_mac_gui.zip?branch=pull/331)
  [![Apple Silicon macOS](https://img.shields.io/badge/OS-Apple%20Silicon%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/unsecure_mac_arm64_gui.zip?branch=pull/331)
  [![ARM64 Android](https://img.shields.io/badge/OS-Android-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/unsecure_android_apk.zip?branch=pull/331)

ACKs for top commit:
  jarolrod:
    ACK 50c73409abb042fb20f00d803aee082981425398

Tree-SHA512: 1dfc95ade573f6620ba67871ff6f609e4bffe4cee877e03bd56c8917ac8cfb184198e5ca603ffda1962a3416da52921c0228eab5f0172011eca44de3d813e0d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants