package com.example.nexilissamplecodeionic; import java.util.ArrayList; import android.os.Bundle; import android.widget.Toast; import com.getcapacitor.BridgeActivity; import io.nexilis.ui.API; import io.nexilis.ui.Callback; import io.nexilis.ui.utils.callback.SimCardDetectionCallback; import io.nexilis.ui.utils.xthunder.FloatingButton; import io.nexilis.ss.SecurityShield; public class MainActivity extends BridgeActivity { @Override protected void onCreate(Bundle savedInstanceState) { registerPlugin(NativePlugin.class); 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 nexilis.io Account, and implement the required Callback. Please Subscribe or contact us to get your nexilis.io Account. Do not share your nexilis.io Account or ever give it out to someone outside your organization. ************************************/ /** * API.connect (String ApplicationName, String NexilisAccount, Activity RegisteredActivity, int NexilisButtonMode, boolean UserMayModifyUID, Callback ConnectCallback) * * ApplicationName : Your Nexilis.io application name. * 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. * */ int nexilisButtonMode = 0; API.connect("***REPLACE***WITH***YOUR***APPLICATION***NAME***", "***REPLACE***WITH***YOUR***NEXILIS***ACCOUNT***", this, nexilisButtonMode, 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. **************************************/ SecurityShield.getInstance().check("***REPLACE***WITH***YOUR***APPLICATION***NAME***", "***REPLACE***WITH***YOUR***NEXILIS***ACCOUNT***",MainActivity.this); runOnUiThread(new Runnable() { @Override public void run() { //FLOATING Toast.makeText(getBaseContext(), "Your User ID: " + NexilisUserID + " : " + getString(io.nexilis.ui.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(); } }); } }); } }