1) Read .csv file from phone, 2) Seach for a keyword 'Apple4321' 3) If keyword found, then look for the nearest word if it is 'send' 4) If the word 'send' is found do some action like 'play music'

In companion app, it didnt work but in laptop while testing with DO IT feature it gave the result by updating the global variable.(When I opened and check the textfile, it is getting updated). BUT THE ISSUE IS THAT APP IS NOT WORKING AFTER INSTALLATION.

Actually, The purpose of the block is to modify the file once when new notification is recieved. Tasker event is set in such a way that the code will run whenever there is file modifications. So, once the file modification is done then Tasker will update the textfile with new onesignalid/keyword according to the Uniqueness of notofication ie, each notification will have some keyword to make it unique.

So, mitai2 app has to 1) Modify File first & 2)After file modification, Tasker will update the text file with another onesignalID/keyword, NOW mit ai2 app has to Parse/read that onesignalID/keyword from the text file.

How can I do it only by using MFile1? Why the app is not responding to new notification if it is installed as .apk?

WHILE TESTING USING DO IT FEATURE, ONLY GLOBAL VARIABLE IS UPDATING ITSELF WITH NEW VALUES BUT LABEL IS NOT WORKING.

I think, it is working when I added these 2 blocks. But, if I include these 2 blocks, it is putting the app in an endless loop (looped using clock3). I want to run these 2 blocks only once/twice additionally after each new Notification is received.

Text File is empty:
-- If text file = empty then go to Clock3 endlessly. Clock3 will read the text file to check if any value got updated or still it is empty.

Text File is not empty:
-- If text file is not empty then parse/read the value first and then make it empty. This time go to clock3 only one or two times (don't go endlessly) after that skip clock 3. Do, this for each new notification, ie, going to clock3 only one or two more times and then skip/stop.

This is working only in Companion and not working after installation.

As you said yourself

if we use a file file:///storage/emulated/0/Download/1.txt in companion then we must delete it before using it in app after installation.

Taifun

1 Like

Hi, MFile.SaveFile block within NotificationReceived Block is not updating file for every new notification.

===================================================================================
Capture

Your blocks work, if

  1. a notification is received while your app is up and running and
  2. the text file is owned by your app

From the documentation App Inventor Extensions: Notification Listener | Pura Vida Apps

Event indicating that a notification has been received.
If your app is up and running, new notifications can be received via this event.

If you want to have it working in the background, you additionally need itoo...

See again Notification Listener (powered by itoox-wrapper) and Itoo

Taifun

1 Like

I kept the app open, it is creating the text file successfully first time. But, after that it is not updating the file with empty text (or with some text) for each new notification. I shall share the .ab file.

From your blocks I only can see empty text... the second time empty text overwrites empty text so in the end nothing happened

Prepare a reasonable example and keep your app open all the time without any other app editing the file...

Tsifun

I tested with other texts as well after the app successfully created the file. It didn't update. I shall share the app here in one minute.

Hi this is the app
csvDataBase2.aia (1.6 MB)

The app has to function like this;

  1. At first, it has to create a text file.

  2. Then, for each new notification, the app must modify/overwrite the text file with some predictable texts like Apple or empty text or etc.

  3. Once mit ai2 app modified the text file, the Tasker (For testing purpose we can put some new text manually in the text file.) will update the same file with new text. NOTE: Tasker code is set in such way that it has to run whenever the text file got modified.

  4. Mit ai2 app will read the text file continuously to detect the changes that will be done by the Tasker and once detected, the new text data will be updated in a global variable and the Label of the app.

ISSUE THAT I FACE:

Mit ai2 app is not updating the text file after once it created the text file.

Updated with Block Images:

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks...

To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...
Thank you.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

There you go
I do not know how many times I already told you

Which means, you have to use SAF or in case you do not plan to publish your app you can

Taifun

1 Like

I do not want to publish this app. This app will be used only on my phone so I don't need to publish. This app is kept open. Up & Running means keeping the App open, right?

Yes
Taifun

1 Like

So, since I do not want to publish the app, can I skip SAF? If so, why the problem persists, ie, not able to delete or overwrite the text file that was successfully created by the same app after installation (not created using companion).

When I tried only this much, everything worked as expected. Let me try more ...

Capture

Thankyou, @Taifun, after including permission blocks as you suggested, it worked.

Again, I am facing a small issue. Now, the text file is successfully getting updated by mit ai2 app with empty data. So, since the file is getting modified, Tasker is also updating the same text file with keyword/some ID.

Now, MIT ai2 app has to parse that data and put it in a global variable and a label. This is not working as expected. But, If I close and open the app again, the label is showing that parsed data from the text file ie, keyword/some ID. But, I want to make that happen without closing and reopening the app.

How can I do that?

How can I solve this issue? I think, part of the code/blocks is not looping successfully so only it may be giving output only when I close and reopen the code. Help me to solve this ...

MY EXPECTATIONS:

My expectation is that these two blocks will loop each other until the global variable will get updated with new keyword. But, facing the above said issue, so the looping may not be working... Give me clarity and guide me to solve this.