mathias5r / rn-heartbeat Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
As the title suggests, would love to see it !
Hello,
I have run your project which working fine, In my app I show modal popup when app is active or in use but when the app closed the popup is not working. can I show this modal popup with this service?
`package com.rnheartbeat;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
public class BootUpReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction() == Intent.ACTION_BOOT_COMPLETED){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//log("Starting the service in >=26 Mode from a BroadcastReceiver")
context.startForegroundService(new Intent(context, HeartbeartService.class));
return;
}
//log("Starting the service in < 26 Mode from a BroadcastReceiver")
context.startService(new Intent(context, HeartbeartService.class));
}
}
}
`
Hi!
I repeated everything you did, but it just doesn't work. Here my example https://github.com/dimonchik-com/rnheartbeat I right understand what Headless JS at the current moment just not working with React Native?
Hi
Please upgrade project react native version 0.61
Hello, it doesn't work on my real phone. Only works on the emulator. My phone is a Xiami Redmi Note 7. Android 9. Help me please.
Please upgrade project react native version 0.61
I am working in similar application where we need to make sure the application stays alive in the background. We are using foreground service for it. (Already used START_STICKY). We also enabled Hermes engine in application.
Issue comes when Android OS kill our app due to any/random reason (Due to Doze mode), Application instance and Foreground service gets re-created as it is declared as START_STICKY. But React-native JS engine does not get re-created.
We have some classes and manager declared in React-native which are not getting created due to this.
2022-04-13, 11:44:54 a.m. | INFO | ["DataConsumer -> Received hr data ",{"hr":76,"error":null,"mean":76,"std":2.7460647515915926,"snr":1.9386964917651681,"R2RAmp":11624.456661888753,"channel":1,"quality":100,"computedHR":0,"timeTaken":134,"startTime":1649864694235,"isRHR":true,"save":true,"leadState":81}]
2022-04-13, 11:44:54 a.m. | INFO | ["DataConsumer -> Saving hr data ",{"hr":76,"error":null,"mean":76,"std":2.7460647515915926,"snr":1.9386964917651681,"R2RAmp":11624.456661888753,"channel":1,"quality":100,"computedHR":0,"timeTaken":134,"startTime":1649864694235,"isRHR":true,"save":true,"leadState":81}]
2022-04-13, 11:44:57 a.m. | INFO | ["DataConsumer: Saving the ECG array for channel 1 with length of :",296400]
2022-04-13, 11:44:59 a.m. | DEBUG | ["DataValidationService: Acc Counter: 2822571"]
2022-04-13, 11:45:01 a.m. | INFO | ["DataConsumer: Saving the ECG array for channel 2 with length of :",296400]
2022-04-13, 11:45:02 a.m. | DEBUG | ["DataValidationService: Temperature 3692. Timestamp: 1649864700"]
2022-04-13, 11:45:03 a.m. | INFO | ["DataConsumer: Saving the ECG array for channel 3 with length of :",296400]
2022-04-13, 11:45:13 a.m. | DEBUG | ["DataValidationService: Ecg Ch: 1, Lead state 1. Counter: 2837265"]
2022-04-13, 11:45:13 a.m. | DEBUG | ["DataValidationService: Ecg Ch: 2, Lead state 1. Counter: 2837265"]
2022-04-13, 11:45:13 a.m. | DEBUG | ["DataValidationService: Ecg Ch: 3, Lead state 1. Counter: 2837265"]
Wed Apr 13 11:45:17 EDT 2022 ForegroundService onCreate called
Wed Apr 13 11:45:18 EDT 2022 ForegroundService onStartCommand
2022-04-13, 12:13:07 p.m. | INFO | ["App: Creating UI"]
2022-04-13, 12:13:07 p.m. | INFO | ["GlobalManager: Starting Managers ... ","2022-4-13 12:13:7"]
2022-04-13, 12:13:07 p.m. | INFO | ["GlobalManager: The build is debug? ",false]
2022-04-13, 12:13:07 p.m. | DEBUG | ["Is Internet connected?",{"details":{"isConnectionExpensive":false},"isInternetReachable":true,"isConnected":true,"type":"wifi"}]
2022-04-13, 12:13:07 p.m. | DEBUG | ["RemoteConfig -> Current environment swithched to","prod"]
2022-04-13, 12:13:07 p.m. | DEBUG | ["App is in foreground",null]
2022-04-13, 12:13:07 p.m. | INFO | ["GlobalManager: DB Initialized"]
2022-04-13, 12:13:07 p.m. | DEBUG | ["Auth manager -> The environment on initial Auth check is ","prod"]
Any idea about it?
Hi, in your article you did something like this:
public class HeartbeatService extends Service {
…
private Handler handler = new Handler();
private Runnable runnableCode = new Runnable() {
@Override
public void run() {
context.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("Heartbeat",null);
handler.postDelayed(this, 2000);
}
};
…
}
But the context you use, here is service context and it doesn't have getJSModule()
method. So how does it work for you? I get an error complaining that this method doesn't exist on this context. Can you please explain how does it work for you?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.