Jump to content

42 posts in this topic

Recommended Posts

Updated

Hello,

Today I will teach you how to add toasts to your mods :)

 

What is a toast?

- Toast is a pop-up message that shows your text when you open the game. There are 2 types of toasts, and I'm going to show you how to implement them :)

 

 

Requirements

- Advanced  ApkTool

- Some Knowledge :D

 

Toast #1

- This toast only shows one line of text

 

mfOW6JP.png

 

Code:

const/4 v0, 0x1

const-string v1, "YOUR MESSAGE @ iOSGods.com"

invoke-static {p0, v1, v0}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;

move-result-object v0

invoke-virtual {v0}, Landroid/widget/Toast;->show()V

 

 

 

Toast #2

- This toast creates a box that can be closed

 

eTH9wUl.jpg

 

Code:

new-instance v0, Landroid/app/AlertDialog$Builder;

invoke-direct {v0, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V

const-string v1, "Information"

invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

move-result-object v0

const-string v1, "YOUR MESSAGE @ www.iOSGods.com"

invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setMessage(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;

move-result-object v0

const-string v1, "Visit US!"

const/4 v2, 0x0

invoke-virtual {v0, v1, v2}, Landroid/app/AlertDialog$Builder;->setPositiveButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;

move-result-object v0

invoke-virtual {v0}, Landroid/app/AlertDialog$Builder;->show()Landroid/app/AlertDialog;

 

Instructions:

1. Download Advanced ApkTool and paste your .APK file inside '2-In' folder

2. Open Advanced ApkTool and type '2' to decompile your .APK file

3. Wait until it fully decompiles

4. The decompiled .APK is located inside '3-Out' folder

5. Go inside that folder and you should see your decompiled .APK in folder form

6. Go inside it and you will find a file named 'AndroidManifest.xml'

7. Open that file and locate to the place where it shows this

 <activity android:configChanges="locale|fontScale|keyboard|keyboardHidden|layoutDirection|mcc|mnc|navigation|orientation|screenLayout|screenSize|touchscreen|uiMode" android:label="@string/icon_label" android:launchMode="singleTop" android:multiprocess="false" android:name="com.gameloft.android.ANMP.GloftA8HM.MainActivity" android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>

8. If you pay attention above  <action android:name="android.intent.action.MAIN"/> there is 'android:name="com.gameloft.android.ANMP.GloftA8HM.MainActivity" '

9. This is the place where the toast is going to be placed; Toasts are always located inside smali folder, so the folder location will be /smali/com/gameloft/android/ANMP/GloftA8HM/MainActivity.smali

10. So go inside the those folder and you will see 'MainActivity.smali', open that file

11. Now search (CTR+F) for this: onCreate  and you should find something like this '.method public onCreate(Landroid/os/Bundle;)V'

12. Now copy the toast code and paste it under '.locals'  (If you don't paste it under .locals it wont work)

13. Remember the first Toast #1 works for all kind of apps but the second Toast #2 only works for 'MainActivity.smali or [Game]Activity' files.

14. After pasting the code, you can change the message to whatever you want to; Message is located here:  const-string v1, "YOUR MESSAGE @ www.iOSGods.com"

13. Now save the file and head back to Advanced ApkTool and type '3' to recompile your .APK

14. Choose your .APK file (Type the number that shows before the name)

15. Then type '2' to recompile and sign the .APK

16. Wait until its fully recompiled and signed (the box will close)

17. You are done implementing the toast :)

 

Toast #1: Works for all kinds of games, mostly used in Unity Games

Toast #2: Only works with MainActivity types of games, usually the games that contain binary files

 

 

Credits:

- @ZahirSher

  • Like 4
  • Winner 2
  • Thanks 6
  • Informative 1
Posted

in case something is missing, you must add these packages to make a poppup toast.

import Android.widget.toast;

Duration of a toast also can be set up using these codes :

LENGTH_SHORT
LENGTH_LONG
  • Informative 1
Posted

in case something is missing, you must add these packages to make a poppup toast.

import Android.widget.toast;
Duration of a toast also can be set up using these codes :

LENGTH_SHORT
LENGTH_LONG

Thanks! Was looking for what's missing!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines