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

Hello I Am new in React Native can you please tell me ho 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.

@ReactMethod

public 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 29741

Trending Articles



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