Giter Site home page Giter Site logo

rn-heartbeat's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rn-heartbeat's Issues

Show modal if even RN project have closed

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?

API >=26 problem is fix

API >=26 problem is fix

`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));
    }

}

}
`

React native JS Engine and Foreground Service

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?

Sending information to React Native level from the service

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.