android-money-manager-ex icon indicating copy to clipboard operation
android-money-manager-ex copied to clipboard

Support for task automation (i.e. Tasker)

Open alensiljak opened this issue 9 years ago • 26 comments

User suggestion:

I receive a lot of sms from my banks with different transactions and it's too hard control them without automation. So the question is how to do that (automate sms input into the program). Do you plan integrate a tasker functionality to your program?

I know one way - use the tasker app. But it needs a way to fill fields in "new transaction" dialog for example.

In other program it can be done with a tasker like this: action - android.intent.action.INSERT arguments - content://com.zvasvari.anmoneyp.AnMoney/books/1/transactions?account=6453&transfer_account=&number=&amount=%sms21&payee=%sms221&category=&class1=&class2=&notes=&status=

alensiljak avatar Apr 17 '15 13:04 alensiljak

Same reason

I'm looking for this functionality for the exact same reason. I'd be super stoked to see it implemented.

DylSharp avatar May 14 '15 06:05 DylSharp

This is not difficult. We might add it for the next release (2.1).

alensiljak avatar May 14 '15 06:05 alensiljak

Exposing the New Transaction activity will also enable creation of shortcuts to this screen directly.

alensiljak avatar May 14 '15 08:05 alensiljak

Specs

action: android.intent.action.INSERT package: com.money.manager.ex class: com.money.manager.ex.transactions.CheckingTransactionEditActivity data: content://parameters?account=account_name&transactionType=transaction_type&amount=amount&payee=payee_name&category=category_name target: Activity

Please pay attention to the parameters in the data field. In the combination "account=account_name", 'account' is the name of the parameter and should be written like this while the 'account_name' is to be replaced by the exact name of the account to be used.

Transaction type must be one of the following: Deposit, Withdrawal.

// to be continued

alensiljak avatar May 14 '15 08:05 alensiljak

The current implementation will open the New Transaction form and let the user inspect the values and confirm or cancel the action.

This functionality should be released in our v2.1 and available to the testing community soon.

alensiljak avatar May 14 '15 13:05 alensiljak

Hi can you give some more details using this function in Tasker?

Tried to add it as a "Send Intent" task but nothing happens when I run it even with the exact same parameters given in the Spec at the data. I assumed it tries to open the MMEX form with the information filled out with parameters.

Apapirra avatar Feb 28 '16 21:02 Apapirra

Thanks for the heads up. The activity has been renamed in the meanwhile so that is probably the cause. The name is now EditCheckingTransactionActivity instead of CheckingAccountActivity. Specs updated. Here is the file, you can also have a look at the implementation. Any suggestions are welcome.

EditCheckingTransactionActivity The related method is externalIntegration(). (code)

alensiljak avatar Feb 29 '16 10:02 alensiljak

Thank you. Probably I'm missing something while testing the Send Intent task in Tasker.

Here is the Tasker task description:

Send To MMEX (5)
A1: Send Intent [ 
    Action:android.intent.action.INSERT 
    Cat:None 
    Mime Type: 
    Data:content://parameters?account=account_name&transactionType=Withdrawal&amount=10&payee=payee_name&category=category_name
    Extra: 
    Extra: 
    Extra: 
    Package:com.money.manager.ex 
    Class: 
    Target:Activity ] 

The account_name is an existing account with the same name while the payee_name and the category_name values aren't in the app. Should all the parameters value be existing data in MMEX or can be anything the app handles it? Also i'm using the MMEX in different language than English.

Apapirra avatar Feb 29 '16 11:02 Apapirra

The parser will use the names provided to fetch the records from the database. This is required due to the fact that the Ids need to be stored.

It might be possible to expand this functionality in the future and to create records if existing names are not found. Unfortunately, it is obvious that currently you are the only one even trying to use this. There was no feedback from the people who originally requested it so the progress on this died out almost a year ago. With some quality feedback as you are providing now, this can be enhanced a bit.

alensiljak avatar Feb 29 '16 11:02 alensiljak

Also, if I may note, the Class may be missing. It should be com.money.manager.ex.transactions.CheckingTransactionEditActivity.

alensiljak avatar Feb 29 '16 11:02 alensiljak

Thank you for the notify, but no success.

I'm using a non-English version of MMEX and I have predefined category names in my language. In this case what should I add as the parameters the translated one or the English? Also in which format? I think that would be a success too if i could get work this function with all the restriction as well, but if the MMEX could handle new parameters received that would be a good way to setup more easily this function.

This is a bit offtopic, but to understand my point: I'm trying to find a good budget-manager application which can be setup to automatically receive data parsed from bank SMS or bank email content. There are some application but they are working only with predefined bank accounts and user cannot setup it's own parser. There is an app (Handwallet's Bank SMS) but it only works with the dedicated app - also there are some issues to work correctly and it's ugly IMO.

Also I'm surfed across many budget apps forums and the bank sms / bank email parser is a highly asked feature from many users. So there is a need for it. Also what I see that develop has not been made or the data processing only woks with some specified banks without any custom bank setup feature. Others can only monitor bank SMSes but no manually entered data (like cash) can be given.

I've found that Tasker could be a good option to not develop a parser / regex app from scratch but normal user (like me) could find a bit difficult to setup. Also many users after trying many other non-working solutions, gives up the search and accepts the situation (like the user originally asked this feature).

I believe that many user get bank SMS / emails regularly from it's account thus if the details already received to the phone why won't one automatically post the details to a budget-manager app? They won't forget to add these bank transfers / bank card transaction as a transaction and only the cash transactions must be added manually to the app. Also one don't have to manage .csv files as well all is automatic. Yet I'm doing .csv import each month so I can see my budget after the end of the month (or next month), not the actual state.

I think the only solution to develop a Parser / Regex app (don't know the correct name) with a good API which can be integrated easily for the budget manager developers, so it would be a win-win situation both for the user, for the parser app's developer and for the budget-manager developer as well.

Apapirra avatar Feb 29 '16 15:02 Apapirra

The fact that a non-English language is used should make no difference. Any entity is searched by Name, which is what is stored in the database. It is simply treated as a text value for which to search. Once the record is found, it's Id value is used for the new transaction.

This used to work but I might need to retry this functionality. A lot has changed in the last year so it is possible that some validation kicks in and prevents saving the transaction or something like that.

alensiljak avatar Feb 29 '16 16:02 alensiljak

If it helps I tried the following in my language (Hungarian): content://parameters?account=account&transactionType=Kiadás&amount=10&payee=shop&category=Étkezés:Élelmiszer

The account, the transactionType (Kiadás= Withdrawal), the payee and the category values are all existing information in my MMEX and used in case sensitive format.

No success.

Note: tried to switch to English but the category names were the same so I stayed on the default language.

Apapirra avatar Feb 29 '16 20:02 Apapirra

This is not working for me, either, but it would be great to be able to add an MMEX transaction from tasker. Anyway I can help debug this?

dcobra avatar Jun 20 '16 14:06 dcobra

Hi, and thanks for the feedback. If there is anyone using Tasker and having some basic knowledge of Android development, it would suffice and help to troubleshoot any issues. Unfortunately, the few times so far, we could not match the interested users and my available time to work on this. When I implemented this, there was nobody to test it out and vice versa. Due to the very low number of interested people, this did not move much higher in terms of priority, either. I would encourage you (all) to install Android Studio and set up a development environment and then test the feature on the actual device with Tasker and real SMS messages from a bank. If by any means you think you can't do it, please see this video. At the same time, I'll try to help as much as I can.

alensiljak avatar Jun 20 '16 14:06 alensiljak

MisterY, thanks for your quick reply. Unfortunately, I have ZERO knowledge of Android development. Hopefully, someone more knowledgeable will come along to help. Just to make sure, though: should Tasker integration work with the stable version of MMEX for Android (the one I just installed from the Play Store), or just with the Beta version?

dcobra avatar Jun 20 '16 14:06 dcobra

The functionality is the same in both versions. Actually, it consists of just an exposed activity (or Intent? can't remember now) that can accept parameters from outside. That's where the Tasker comes in. I successfully ran it using some apps that allow creating custom intents but that is all. The original requestor never again responded.

On the other hand, I'd encourage you to watch at least the first 5 minutes of the video I added to my comment above after it was originally written. This is a fantastic way to look at coding and is trully inspirational. :)

I also did not know much about Android development before joining this project.

alensiljak avatar Jun 20 '16 14:06 alensiljak

Hi again, MisterY.

I installed the app QuickShortcutMaker and with it I was able to find out that the correct class is com.money.manager.ex.transactions.CheckingTransactionEditActivity (in the directions you gave above, "transactions" is missing and "Edit" is misplaced - or perhaps the class name changed again since then). With the corrected class, Tasker was able to open the "New Transaction" window in MMEX with the specified account and amount.

However, I'm still missing one thing to get the functionality I wanted: is there any way to accept the new transaction without having to click "OK"? Otherwise, I won't be able to use Tasker to insert more than one transaction at a time!

dcobra avatar Jun 20 '16 15:06 dcobra

Hi! That's great progress. Yes, it is very possible that the Activity name has change afterwards, which would explain a few things. I have updated the instructions above, thank you. Hope that helps a few people out there. Unfortunately, to answer your main question, there is currently no option to automatically save without confirming (pressing OK button). However, if this works correctly, some adjustments could be made with a specific Activity being created to handle this whole scenario with integration. Or adjusting the integration function to simply call save.

alensiljak avatar Jun 20 '16 15:06 alensiljak

Ok. In my case, I am not trying to process SMSs from my bank, but to quickly record an expense from my Android Wear smartwatch.

I will try to use the Tasker AutoInput plugin to automatically click the OK button, but it would be great if the whole operation could be done using intents. I'll keep an eye on this thread to see if you get a chance to implement this in the future.

Thanks for your help!

dcobra avatar Jun 20 '16 15:06 dcobra

A separate parameter could be introduced to handle the final step(s) - whether to save or display the form to the user for confirmation.

alensiljak avatar Jun 21 '16 12:06 alensiljak

Hi is this functionality working? and where is final specification? I would like to test this

Houd1ny avatar Jan 28 '18 20:01 Houd1ny

Just tried this with Automagic and it mostly works. But it seems to not be possible to specify currency, notes, and destination account (for Transfer transaction). Looking at the source code, there are not even such fields in the IntentDataParameters class, which is used to obtain parameters from the intent. While for limited SMS parsing (I think it's issue #1144) currency and some other parameters are processed. Is there any reason not to allow specifying all UI-editable parameters in the external intent integration?

alex-che avatar Jan 08 '19 12:01 alex-che

As can be seen in #1276, we will no longer be able to request SMS permissions if distributing through Play Store. Hence, the only way to have the sms-to-transaction functionality will be through a specialized 3rd-party component.

alensiljak avatar Jan 09 '19 09:01 alensiljak

@alex-che, no, there is no specific reason. Please feel free to submit a pull request.

alensiljak avatar Jan 09 '19 09:01 alensiljak

@alex-che, I've already made a pull request in order to add some additional parameters such as: accountTo, amountTo, subcategory, notes, silent (silent save)

drronich avatar Jan 12 '19 08:01 drronich

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Mar 25 '24 00:03 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Mar 31 '24 00:03 github-actions[bot]