Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29508

How to get Native Module return value?

$
0
0

I want this promise value in App.js class with button click. Please help me in finding out the solution.

@ReactMethodpublic void initTimerService(Promise promise){    TimerService timerService = App42API.buildTimerService();    String timerName = "<Enter_your_timer_name>";    long timeInSeconds= 120;    timerService.createOrUpdateTimer(timerName, timeInSeconds, new App42CallBack() {        public void onSuccess(Object r)        {            Log.e(TAG,"response = "+ r);            Timer timer = (Timer)response;            promise.resolve(timer.getName());            System.out.println("Timer Name is: "+ timer.getName());            System.out.println("Time is: "+ timer.getTimeInSeconds());        }    });}

Viewing all articles
Browse latest Browse all 29508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>