I need help to send notifications using extensions

hi everyone,

i tried to use MelonNotifications and Itoo extensions but didn’t work for me step by step from the AI Mode :sweat_smile: , so i thought you may have a better methods, show me in blocks if it works..i also have tried one signal notifications using firebase console even tho i am using Gsheet as a database tried with editing the api script adding the one signal notifications, and the one signal notifications doesn’t gave me much choices when the AI gives me steps sometime it works sometime is not..so help me with blocks please if my blocks can be fixed…this is where i am so far :

Hello dear,

there’s a lot of tutorials, which one have you followed?

Melon

OneSignal

hi @Ibrahim_Jamar

i think of something like mustafaalbasel done, but without the need for the buttons open and close,

but sadly looks like the extension needs and update as Kumaraswamy said :

It is a bug in the extension, the behavior for alwaysOnMain is inverted. Please set it to true for the time being until the next update.

:sweat_smile:

the second method, i didn’t like it because its a third party appear on the notification OneSignal but i tried something like you did in the video but didn’t work with me, but i well try it again using your video, thanks,…and if there is another method from the app itself using kodular is welcome :hugs:

The bug is already resolved long time ago. Check the later versions.

You are doing it all wrong. Check the example AIA posted in the MelonNotification topic.

2 Likes

thanks i well :star_struck:

worked but only when the app is running!

i want it to send the notification when the user add while the app closed running in the background service, does this blocks usable :

i think its wrong i am just trying something like that, it worked without these blocks inside when web got text event, which means only when the app is running and the user refresh the list only not when i add anything directly in the sheet…any idea :thinking:

2 Likes

thanks..but didn’t work EXAMPLE 7 :anguished_face:

Google Apps Script, the Web component and a timer

the original blocks:

my blocks and script :



just didn’t used the buttons blocks, because i don’t want the notification to be triggered by buttons.

What is not working?

Hi dear,

immagine
immagine
the parameter must be the same as the event, so response not respones

2 Likes

You forgot to ask for Post Notifications permission
Obviously no notifications will be displayed then

Taifun

1 Like

its not the problem because the permission is already granted, i used the true way as in the second picture before, but i changed it later :sweat_smile: but thanks i well make it as you suggested :+1:

:face_with_peeking_eye:
thanks
fixed and still the notification not appears, is it because i am using the companion? :thinking:

the notification not appearing, i didn’t figure where is the problem in my blocks :sweat_smile:

Yes
Taifun

i tried to export the app but it fail to build it:

:downcast_face_with_sweat:

GoogleSheetAPI Extension is the problem, every time i delete it then i reload kodular page the extension returns :expressionless_face:

You can remove it manually from the .aia file

assets\external_comps


1 Like

even from the apk app installed and still not appears with permission granted..clock enabled:

is there a problem with the script :

:thinking:

ItooService is running in the Running Services but 0 process and 1 service, while all the apps has at least 1 process, so i think the problem is in the script…beside it show a message when i open the app :

maxi keeps stopping
app info
close app

i figure out the issue of keeps stopping : i am using Android 14

especially on Android 14+


does itoo extension can cause app keeps stopping app info, close app !

AI Overview
Yes, the Itoo extension for MIT App Inventor/Kodular can cause apps to frequently crash, stop, or close unexpectedly ("App keeps stopping" error). 
Based on community reports, this is primarily due to compatibility issues with newer Android versions, particularly with apps built after August 17, 2024, which often crash immediately upon launch. 
Here are the specific reasons and solutions identified for Itoo extension crashes:
Reasons for Itoo Extension Crashes
Android Compatibility (August 2024 Issue): Builds made after August 17, 2024, utilizing Itoo, tend to crash on launch, especially on Android 14+.
Foreground Service Misconfiguration: If not properly configured with required foreground service types (like "SpecialUse" or "ConnectedDevice"), Android may terminate the service, leading to a crash.
UI Interaction in Background: Attempting to update user interface components (e.g., Labels, TextBoxes, Notifiers) from the background service will cause the app to crash.
Incorrect Data Storage: Using TinyDB in the background instead of Itoo’s native Fetch / Store blocks can lead to crashes.
Missing 'x' Argument: The main background procedure in Itoo requires an argument x to function correctly. 

maybe i didn’t set it correctly :downcast_face_with_sweat:

full script :

function doGet(e) {

const scriptProperties = PropertiesService.getScriptProperties();

if (e.parameter.do == "get") {
  const message = scriptProperties.getProperty('message');
  return ContentService.createTextOutput(message);
}
else if (e.parameter.do == "set") {
  scriptProperties.setProperty('message', e.parameter.message);
}

return ceksheet(e);


}



function doPost(e) {


return ceksheet(e);


}



function ceksheet(e) {



// Safety check


if (!e || !e.parameter) {


return ContentService.createTextOutput("Error: No parameters received")


.setMimeType(ContentService.MimeType.TEXT);


}



var ss = SpreadsheetApp.getActive();


var sh = ss.getSheetByName(e.parameter.SH);



if (!sh) {


return ContentService.createTextOutput("Error: Sheet not found")


.setMimeType(ContentService.MimeType.TEXT);


}



var func = e.parameter.func;



// ================= INSERT =================


if (func === "insert") {



var a = e.parameter.A || "";


var b = e.parameter.B || "";


var c = e.parameter.C || "";


var d = e.parameter.D || "";


var valE = e.parameter.E || "";


var f = e.parameter.F || "";


var g = e.parameter.G || "";


var h = e.parameter.H || "";


var valI = e.parameter.I || "";


var j = e.parameter.J || "";


var k = e.parameter.K || "";


var l = e.parameter.L || "";


var m = e.parameter.M || "";


// Check duplicate in column A


var lr = sh.getLastRow();


if (lr > 0) {


var colA = sh.getRange(1, 1, lr, 1).getValues();


for (var r = 0; r < colA.length; r++) {


if (colA[r][0] == a) {


return ContentService.createTextOutput("Data error: Already exists")


.setMimeType(ContentService.MimeType.TEXT);


}


}


}



// FORCE write till column m (important fix)


var row = lr + 1;


sh.getRange(row, 1, 1, 13).setValues([[


a, b, c, d, valE, f, g, h, valI, j, k, l, m


]]);



return ContentService.createTextOutput("Done")


.setMimeType(ContentService.MimeType.TEXT);


}



// ================= UPDATE =================


if (func === "UPDATE") {



var a = e.parameter.A || "";


var b = e.parameter.B || "";


var c = e.parameter.C || "";


var d = e.parameter.D || "";


var valE = e.parameter.E || "";


var f = e.parameter.F || "";


var g = e.parameter.G || "";


var h = e.parameter.H || "";


var valI = e.parameter.I || "";


var j = e.parameter.J || "";


var k = e.parameter.K || "";


var l = e.parameter.L || "";


var m = e.parameter.M || "";



var lr = sh.getLastRow();


var colA = sh.getRange(1, 1, lr, 1).getValues();



for (var r = 0; r < colA.length; r++) {


if (colA[r][0] == a) {


var row = r + 1;


sh.getRange(row, 1, 1, 13).setValues([[


a, b, c, d, valE, f, g, h, valI, j, k, l, m


]]);


return ContentService.createTextOutput("Data UPDATED")


.setMimeType(ContentService.MimeType.TEXT);


}


}



return ContentService.createTextOutput("Update Failed: ID not found")


.setMimeType(ContentService.MimeType.TEXT);


}



// ================= DELETE =================


if (func === "DELETE") {



var a = e.parameter.A || "";


var lr = sh.getLastRow();


var colA = sh.getRange(1, 1, lr, 1).getValues();



for (var r = 0; r < colA.length; r++) {


if (colA[r][0] == a) {


sh.deleteRow(r + 1);


return ContentService.createTextOutput("Data DELETED")


.setMimeType(ContentService.MimeType.TEXT);


}


}



return ContentService.createTextOutput("Delete Failed: ID not found")


.setMimeType(ContentService.MimeType.TEXT);


}



// ================= SEARCH =================


if (func === "search") {



var a = e.parameter.A || "";


var data = sh.getDataRange().getValues();



for (var r = 0; r < data.length; r++) {


if (data[r][0] == a) {


return ContentService.createTextOutput(


"Found|" + data[r].join("|")


).setMimeType(ContentService.MimeType.TEXT);


}


}



return ContentService.createTextOutput("Not Found")


.setMimeType(ContentService.MimeType.TEXT);


}



// ================= GET ALL =================


if (func === "GET_DATA") {



var data = sh.getDataRange().getValues();


var out = "";



for (var r = 1; r < data.length; r++) {


out += r + ". " + data[r].join(" - ") + "|\n";


}



return ContentService.createTextOutput(out)


.setMimeType(ContentService.MimeType.TEXT);


}



return ContentService.createTextOutput("Invalid function")


.setMimeType(ContentService.MimeType.TEXT);


}




also i tried to delete this line since i didn’t used the do set :

else if (e.parameter.do == “set”) { scriptProperties.setProperty(‘message’, e.parameter.message); }

still the notification not appears.

It would really help if you provided an updated screenshot your relevant blocks, so we can see what you are trying to do, and where the problem may be.

Taifun

This is the correct script, have you deployed it correctly? (you should be able to test the url in Web1.URL in your computer browser):

function doGet(e) {

const scriptProperties = PropertiesService.getScriptProperties();

if (e.parameter.do == "get") {
  const message = scriptProperties.getProperty('message');
  return ContentService.createTextOutput(message);
}
else if (e.parameter.do == "set") {
  scriptProperties.setProperty('message', e.parameter.message);
}

}

as suggested show all your relevant blocks, including full urls