Is it possible to make an app that notifies me with alarm sound when I get new mail from specicific email id?

I asked chatgpt about the possibility to achieve the same result by combining 'Notification Listener + TinyDB + Alarm'. Chat GPT gave me a big reply but I am sharing part of it. The below lines are given by chatgpt.

// When a new notification is received
Title = "New Order"
Message = "You have a new order!"
UniqueIdentifier = "Order123" // Unique identifier for the notification

// Store notification in TinyDB
TinyDB1.StoreValue("Notifications", UniqueIdentifier, Message)

// Display notification using Notifier
Notifier1.ShowNotification(Title, Message, "default")

// Check if the notification should trigger an alarm
If UniqueIdentifier = "Order123"
// Play alarm sound
Sound1.Play()
End If

THE COMPLETE CHATGPT REPLY IS GIVEN BELOW:

QUESTION:

How can I create an app using mit app inventor in such a way that the app will store the notifications in tinyDB and give alarm sound only to specific notification?

ANSWER:

To create an app in MIT App Inventor that stores notifications in TinyDB and plays an alarm sound only for specific notifications, you can follow these steps:

  1. Design the App UI:

    • Create the user interface with components like buttons, labels, a Notifier, and a Sound component.
  2. Add TinyDB Component:

    • Include the TinyDB component in your project, which will be used to store notifications.
  3. Implement Notification Handling:

    • When a new notification is received, add the notification details to TinyDB.
    • You can use TinyDB's StoreValue block to store information like notification title, message, or a unique identifier for the notification.
  4. Trigger Notification and Sound:

    • When displaying notifications, check if the notification meets the criteria for playing the alarm sound.
    • Use a conditional statement to determine whether to play the sound or not.
  5. Play Alarm Sound:

    • If the condition for playing the sound is met, use the Sound component to play the alarm sound.

Here's a simplified example in pseudocode:

// When a new notification is received
Title = "New Order"
Message = "You have a new order!"
UniqueIdentifier = "Order123"  // Unique identifier for the notification

// Store notification in TinyDB
TinyDB1.StoreValue("Notifications", UniqueIdentifier, Message)

// Display notification using Notifier
Notifier1.ShowNotification(Title, Message, "default")

// Check if the notification should trigger an alarm
If UniqueIdentifier = "Order123"
    // Play alarm sound
    Sound1.Play()
End If

Remember to adapt this pseudocode to your specific use case and logic. You may need to modify the conditions for playing the sound based on your notification criteria.

Test your app thoroughly to ensure that notifications are stored correctly in TinyDB, and the alarm sound is played only for the specified notifications.

If the question is incorrect, the answer will be incorrect, too...

This is what you asked earlier

make an app that notifies me with alarm sound when I get new mail from specicific email id

Taifun

Yes, that (1st question) was my actual goal. But, I am trying in different ways to see the same result.

The purpose is to hear continuous alarm sound when I get new order (new orders will be notified via email by ECWID but I want to hear continous alarm sound for that.)

Created something like this, but not working as intended. This one is giving alarm for all notifications. I want Alarm only for emails with the word 'ecwid' in it.

This one almost worked.
blocks (12)

Reference:

  1. https://www.youtube.com/watch?v=TUpLc_nTqLs&pp=ygUmbm90aWZpY2F0aW9uIGxpc3RlbmVyIG1pdCBhcHAgaW52ZW50b3I%3D

  2. https://www.youtube.com/watch?v=7eb6xy_nUBk

If there is better idea than this, share the idea here.

Okay, I think the next thing that I have to do is 'to work on background extension' as said by @Taifun earlier.

what about this?

https://ai2.appinventor.mit.edu/reference/blocks/text.html#contains

contains
Returns true if piece appears in text; otherwise, returns false.

Taifun

1 Like

Il learn more about it.

@Taifun , Can you guide me to include Itoo extension in this.

blocks (12)

your solution does not really work
it looks like you did not understand, how the contains block works
also you are ignoring the json result, which is returned from the notification listener completely

what about trying the suggestion I posted earlier?

And concerning itoo, read the complete itoo thread, try the simple examples, try the batterychecker tutorial and after you got some experience, then continue with your project in the background

Taifun

1 Like

Okay @Taifun , so do I have to covert json into text first? I am not able to predict precisely what you say as a newbie. Can you explain as how any one explain to a 10 yr old kid?

Modified the app little bit.

blocks (14)

74edfc15f24d71164d2ec25eb84b398f8dfe7171_2_690x259

Okay @Taifun , as I tried to grasp, I guess that,

  1. If the word in Text & Piece matches, then sound will be played.
  2. If not matched, sound will not be played.

But, you marked json in the image with arrow mark towards text. So, I guess that you are saying to make the blocks in such a way that it will look for json-text and not usual text. If i am right, please share ideas to do that.

UPDATE:

Okay, when I hover mouse on json, I found options that can be entered in text region.

Update 2: Not working. Can you help me to solve. block image below.

blocks (19)

1 Like

What is not working?

App is not opening. Getting closed before opening itself.

Ah hm really? Maybe post the APK file here.
(You may need to upload the APK to drive)

okay.
AlarmTry_copy.aia (1007.2 KB)

1 Like
1 Like

Okay, Yesterday it worked and today it is not working. @Kumaraswamy . I shall wait for the mit app inventor update. It will be good if you make available the older version as well while you are updating the mit ai2 into a newer version .

When this bug will be solved? Because, yesterday I didn't face this bug. Before that I shall try alternative ways to bring the same result.

When it is solved. MIT work on US eastern time. And it is the weekend.

1 Like

When I asked to chatgpt about alternative way to bring the same result, it says to connect with ECWID API to watch the new orders. So, I wish to create an app like that as well. Can you give tips for that. Thankyou.

I got API details from ecwid to customise the ecwid-shop-code. Is that API deails enough to create the app that notifies new orders - using mit app inventor?