Skip to content

Instantly share code, notes, and snippets.

@iddoeldor
Forked from myzhan/makeToast.js
Created August 5, 2018 14:06
Show Gist options
  • Save iddoeldor/1b6cc1196c77528d39b4fced191a6013 to your computer and use it in GitHub Desktop.
Save iddoeldor/1b6cc1196c77528d39b4fced191a6013 to your computer and use it in GitHub Desktop.
Frida android make toast
Java.scheduleOnMainThread(function() {
Toast = Java.use("android.widget.Toast");
var currentApplication = Java.use('android.app.ActivityThread').currentApplication();
var context = currentApplication.getApplicationContext();
Toast.makeText(context,"hello world", Toast.LENGTH_SHORT.value).show();
});
@yodiaditya
Copy link

This is not working. Finally, i fix it with :

Java.perform(function () { 
    var context = Java.use('android.app.ActivityThread').currentApplication().getApplicationContext();

    Java.scheduleOnMainThread(function() {
            var toast = Java.use("android.widget.Toast");
            toast.makeText(Java.use("android.app.ActivityThread").currentApplication().getApplicationContext(), Java.use("java.lang.String").$new("This is works!"), 1).show();
    });
});

For detail info about debugging and problem : https://www.yodiw.com/frida-android-make-toast-non-rooted-device/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment