Tutorial A Basic "License-Like" Tutorial For Native Mod (Android Studio)

dingdingdong

Platinian
Original poster
Apr 5, 2018
10
31
13
26
china
Hello guys, this is just a SIMPLE tutorial on how to add some "License-like" function on your native mod (with menu or not) which created using Android Studio.

!!! ATTENTION !!!
This is a VERY BASIC and for education only, never ever apply any of this tutorial to your private mod or selling mods with this without any encryption or protection, since i didn't put any extra code for security or prevent someone to crack your private/bussines mod. This is an example so it will 10000000000% cracked, make your own protection code and never copy-paste stuff.

!!! PS !!!
NEVER EVER HARDCODE ANY STRING ON YOUR .java/class project, since it will be easly modified when it turn into .smali

Here's what you need to prepare first :
1. A place to put your file (.txt or whatever) which will contains all data like serialnumber, expiration date, mac address, or anything that will be accessed from our mod.
You can use this one : Free Web Hosting - Host a Website for Free with Cpanel, PHP
2. A cup of coffe or tea or milk or whatever.

Now Let's get to our main point :
1. Open up your Android Studio, an add these function on your mod menu services / java / class (if you don't know which one, it's the place where you design your mod menu template).

Java:
// checking if any network connection / internet available
private boolean isNetworkConected(){
    ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    return cm.getActiveNetworkInfo() != null;
}

// calling our AsyncTask Function that will do thee thing on fetching data from out host file
private void getSerial(){
    new FetchText().execute("https://dingdingdooong.000webhostapp.com/vivov1718.txt");
}

// this is the checking one, this will draw our menu if it's license still valid or active
public void checkSerial(String isvalid){
    if (isNetworkConected() && isvalid != null){
        CreateMenu();
    }
    else {
        Toast.makeText(getBaseContext(), "YOUR DEVICE NOT REGISTERED OR EXPIRED!!", Toast.LENGTH_LONG).show();
    }
}

// this is our main function, it will fetching all the data from our file on our hosting
@SuppressLint("StaticFieldLeak")
    private class FetchText extends AsyncTask<String, Integer, String> {

        @Override
        protected String doInBackground(String... strings) {
            URL url;
            String fetched = null;
            try {
                url = new URL(strings[0]);
                HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();
                InputStream inputStream = httpURLConnection.getInputStream();
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
                String line;
                while ((line = bufferedReader.readLine()) != null){
                    fetched = line;
                }
            }
            catch (Exception e){
                e.printStackTrace();
            }
            return fetched;
        }

        @Override
        protected void onPostExecute(String s) {
            checkSerial(s);
        }
    }
2. On your nnCreate() method, call getSerial() and remove any method to drawing your mod menu then put it on checkSerial() true condition.

3. Develop all those function for your own need, improve it!

4. Here is a video on where to put all of those code if you a lil bit lazy pumping your brain.

5. If you successfully build your mod with this tutorial, go to the top of this thread content, and read my ATENTION and PS.

6. If you don't, feel free to ask me on this thread, not on pm.

I already explain anything, if you still don't understand, try to read each line and understand what those line function or do. Love the process not only the result.
 
Last edited:

dingdingdong

Platinian
Original poster
Apr 5, 2018
10
31
13
26
china
What is license like?
limiting people for using an application with some kind of license policy, like trial or activation code in order to use that application.
in this tutorial i call it "license-like" because i only giving people some image about how licensing stuff work with a basic example