package com.nexilissamplecode; import android.os.Bundle; import android.widget.Toast; import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; import com.facebook.react.defaults.DefaultReactActivityDelegate; import io.nexilis.service.API; import io.nexilis.service.Callback; import io.nexilis.service.utils.callback.SimCardDetectionCallback; import io.nexilis.service.utils.xthunder.FloatingButton; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. */ @Override protected String getMainComponentName() { return "NexilisSampleCode"; } /** * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React * (aka React 18) with two boolean flags. */ @Override protected ReactActivityDelegate createReactActivityDelegate() { return new DefaultReactActivityDelegate( this, getMainComponentName(), // If you opted-in for the New Architecture, we enable the Fabric Renderer. DefaultNewArchitectureEntryPoint.getFabricEnabled()); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /** * * Nexilis provides an API security shield service, which functions to detect threats such as malware, ADB, screencapture, and Sim Swapping. */ //SECURITY //SMS //EMAIL //SMARTBOT /************************************* Connect to our server with your newuniverse.io Account, and implement the required Callback. Please Subscribe or contact us to get your newuniverse.io Account. Do not share your newuniverse.io Account or ever give it out to someone outside your organization. ************************************/ /** * API.connect (String NexilisAccount, Activity RegisteredActivity, int NexilisButtonMode, boolean UserMayModifyUID, Callback ConnectCallback) * * NexilisAccount : Your Nexilis.io Account. * RegisteredActivity : Android's Activity class that is used to register the Nexilis Button * NexilisButtonMode : The flag that determines when the Nexilis Button should appear. * 0 = Disabled Nexilis Button * 1 = Within registered Activity, (Nexilis Button only appears when users are in the registered activity) * 2 = Within App (Nexilis Button always appears as long as user is in the App), * 3 = Always On (Nexilis Button always appears even if the application process is closed) * UserMayModifyUID : Sets whether users are allowed to change the Nexilis UserID. * true = enabled, * false = disabled * ConnectCallback : The callback interface to be invoked when calling the method connect. * You need to implement onSuccess(String NexilisUserID) & onFailed(String reasonCode) to handle the RESULT. * */ API.connect("***REPLACE***WITH***YOUR***NEXILIS***ACCOUNT***", this, 0, new Callback() { @Override public void onSuccess(final String NexilisUserID) { /************************************** The NexilisUserID parameter is generated automatically and can be mapped to a User ID on the application level. For example, the Nexilis User ID (e.g. User001) can be mapped into the corresponding Application User ID (e.g. John Doe), so you don't have to share your Application User ID with Nexilis while still being able to monitor your user activities. **************************************/ runOnUiThread(new Runnable() { @Override public void run() { //FLOATING Toast.makeText(getBaseContext(), "Your User ID: " + NexilisUserID + " : " + getString(io.nexilis.service.R.string.pb_loading), Toast.LENGTH_LONG).show(); } }); } @Override public void onFailed(final String reasonCode) { /** * reasonCode : Returns a code based on the status of the function connect called. * 2:Your trial subscription has expired. Please subscribe to continue using Nexilis. * 3:Your monthly subscription is not paid in full. Please pay your monthly subscription bill to continue using Nexilis service. * 4:Your Customer Engagement Credit has run out and your Prepaid Credit Balance is empty. Please top-up your Prepaid Credit Balance to continue using Nexilis * 23:Unsupported Android version * 93:Missing the required overlay permission * 94:Unregistered User * 95:Invalid Nexilis Button Mode (1,2,3) * 96:Activity is null * 97:Account is empty * 98:Your account didn't match * 99:Something went wrong */ runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getBaseContext(), reasonCode, Toast.LENGTH_LONG).show(); } }); } }); } }