Remove All Ads from XDA

[Help] Notifications & Toasts don't work

35 posts
Thanks Meter: 5
By BlindWanderer, Member on 21st December 2019, 06:07 AM
Post Reply Email Thread
So, I'm writing my very first module and everything works except notification/toast creation. I don't know why.

The best I've managed is ONE toast but never again. I haven't even managed a single notification. What could I be doing wrong?

What drives me crazy is that the thread runs without error. I get my XposedBridge.log()'s just fine. I even throttled the reporting to no faster than every 5 seconds.

I've tried running the following from my thread. I've tried running it on the MainLooper (WTF Google, why can't you do something like Swing?)
// INSIDE my worker thread run
Application app = AndroidAppHelper.currentApplication();
mNotifyManager = (NotificationManager) app.getSystemService(Context.NOTIFICATION_SERVICE);
mBuilder = new NotificationCompat.Builder(app);
mBuilder.setContentTitle("File Thinger")
		.setContentText("Thinging in progress")
// INSIDE my worker thread reporting code

//Handler handler = new Handler(Looper.getMainLooper());
// Runnable() {
//	 public void run() {
		if (!TextUtils.isEmpty(message)) {
			if (toast != null) {
				toast.cancel(); //dismiss current toast if visible
			} else {
				toast = Toast.makeText(app, message, duration);
//	}

mBuilder.setProgress(me, mp, false);
XposedBridge.log(cp + "% (" + mp + " / " + me + ")");
For added funzies, I'm working in NoxPlayer with Android 5.
21st December 2019, 07:24 AM |#2  
OP Member
Thanks Meter: 5
I got Toast working. I put everything in the runnable. No idea why notifications aren't working.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes