Topic | Broadcast Intents: How to use it???

Home Forums Mooshimeter Support Broadcast Intents: How to use it???

Tagged: 

This topic contains 7 replies, has 3 voices, and was last updated by  crada 2 years, 9 months ago.

  • Author
    Posts
  • #14624 Reply

    crada
    Participant

    Hi,

    I would like to know more about how to use the “Broadcast Intents” feature. (BTW it is miss spelled in the menu as “Boardcast” in the beta app)

    When turned it ON, I don’t see any intents been broadcast system-wide, neither I get asked by the system to choose with app to send the intent.

    It is the feature actually working? If yes: What are the parameters of the intent so I can get other app to capture it? (i.e. set up the right intent filter)

    I’ve try to capture mooshimeter’s intents using Tasker anda a few utility apps designed to capture most system-wide intents, but I don’t see any intents being issued when I turn ON that feature in the Mooshimeter App.

    Thanks!

  • #14627 Reply

    phedders
    Participant

    This was working for me:

    Profile: Mooshimeter Broadcast (263)
    Event: Intent Received [ Action:com.mooshim.mooshimeter.SAMPLE_INTENT Cat:None Cat:None Scheme:* Mime Type:* ]
    Enter: Mooshimeter Bcast (264)
    A1: Flash [ Text:%value %units Long:Off ]
    A2: AutoPebble Quick Screen [ Configuration:ID: mooshimeter
    Full Screen: true
    Title: Mooshimeter
    Top Label: Update
    Middle Label: %value
    Bottom Label: %units
    Command Prefix: moosh
    Text Font: Droid Serif 28 Bold
    No Prefix if Command: false
    Do Not Disturb: false
    Clear History: false
    Open Phone App: true
    Save Scren: false
    Don’t Send Screen: false
    Go Back: false
    Go Back Multi: false Timeout (Seconds):120 ]
    A3: [X] AutoTools Action Report [ Configuration:Separator: , Timeout (Seconds):60 ]
    A4: [X] Popup [ Title: Text:%default_input_method
    %location_mode Background Image: Layout:Popup Timeout (Seconds):5 Show Over Keyguard:On ]

  • #14631 Reply

    James
    Keymaster

    Hi crada,

    Duane put together some instructions on how he uses it, I hope it helps:
    https://www.docdroid.net/3ZLahNf/mooshimeter-app-can-perform-other-tasks2.docx.html

    Thanks for noticing the spelling error, will correct it.
    Best
    ~James

  • #14632 Reply

    crada
    Participant

    Hi James, Thanks for that document!! You should put it in the wiki, it is very helpful.
    Thanks to phedders I had managed already to capture the intents, and do stuff. But as Duane comments on those instructions, Channel #1 data get broadcasted very often (few times per second), but Channel #2 data gets broadcasted very rarely (at variable intervals between few seconds to few tens of seconds).
    Why that happens? How it can be solved?
    Maybe it would make more sense to put the information of both channels on each intent.

    Below I’ve copied an example of the data received trough intents. First column is a time stamp in milliseconds, the second the value and the third the unit. As you can see, the current is reported much more often than the voltage.

    1477942856805, 1.8626451E-4, A
    1477942857133, 1.1175871E-4, A
    1477942857534, 1.527369E-4, A
    1477942857863, 1.4528632E-4, A
    1477942858344, 5.9604645E-5, A
    1477942858680, 6.3329935E-5, A
    1477942859149, 3.7252903E-6, A
    1477942859816, 1.4901161E-5, A
    1477942860540, 1.3783574E-4, A
    1477942860894, 5.5879354E-5, A
    1477942861282, 7.4505806E-5, A
    1477942861619, 8.940697E-5, A
    1477942862012, 1.4528632E-4, A
    1477942862763, 1.3411045E-4, A
    1477942863088, 1.527369E-4, A
    1477942863474, 1.527369E-4, A
    1477942864226, 9.313226E-5, A
    1477942864619, 2.2351742E-5, A
    1477942864890, 9.685755E-5, A
    1477942865291, 3.7252903E-5, A
    1477942865722, 9.313226E-5, A
    1477942866454, 1.3038516E-4, A
    1477942866741, 1.4156103E-4, A
    1477942867149, 1.7136335E-4, A
    1477942867453, 4.4703484E-5, A
    1477942867948, 5.5879354E-5, A
    1477942868182, -1.8626451E-5, A
    1477942868630, 8.940697E-5, A
    1477942868931, 5.6773424E-5, V
    1477942869352, 9.313226E-5, A
    1477942869665, 5.5879354E-5, A
    1477942870081, 1.1920929E-4, A
    1477942870818, 9.313226E-5, A
    1477942870993, 1.8924475E-5, V
    1477942871390, 6.3329935E-5, A
    1477942872116, 1.1920929E-4, A
    1477942872537, 1.15484E-4, A
    1477942872824, -3.7252903E-5, A
    1477942873238, 7.4505806E-5, A
    1477942873572, 5.6773424E-5, V
    1477942873931, 1.8626451E-4, A
    1477942874378, 1.6763806E-4, A
    1477942874674, 1.2665987E-4, A
    1477942875088, 8.568168E-5, A
    1477942875456, 1.15484E-4, A
    1477942875764, 1.4901161E-4, A
    1477942876205, 1.6018748E-4, A
    1477942876482, 1.0058284E-4, A
    1477942876908, 7.0780516E-5, A
    1477942877247, 4.8428774E-5, A
    1477942877647, 8.568168E-5, A
    1477942877975, 5.5879354E-5, A
    1477942878727, 7.4505806E-5, A
    1477942879078, 1.6391277E-4, A
    1477942879581, 1.3038516E-4, A
    1477942880147, 1.4156103E-4, A
    1477942880589, 1.2293458E-4, A
    1477942881189, 1.2293458E-4, A
    1477942881938, 5.2154064E-5, A
    1477942882226, 1.6763806E-4, A
    1477942882599, 1.3411045E-4, A
    1477942883348, -4.0978193E-5, A
    1477942883664, 1.2293458E-4, A
    1477942884083, 8.568168E-5, A
    1477942884383, 5.5879354E-5, A
    1477942884776, 2.2351742E-5, A
    1477942885137, -1.4901161E-5, A
    1477942885602, 2.9802322E-5, A
    1477942885889, 2.6077032E-5, A
    1477942886329, 1.15484E-4, A
    1477942887069, 1.1175871E-4, A
    1477942887745, 1.8626451E-5, A
    1477942888075, 2.9802322E-5, A
    1477942888494, 1.3038516E-4, A
    1477942888809, 1.899898E-4, A
    1477942889185, 1.0430813E-4, A
    1477942889968, 1.3038516E-4, A
    1477942890345, 1.4901161E-4, A
    1477942890680, 4.4703484E-5, A
    1477942891319, 4.0978193E-5, A
    1477942892105, 7.4505806E-5, A
    1477942892376, 7.56979E-5, V

  • #14717 Reply

    James
    Keymaster

    Hi Crada,

    Interesting… here is my hypothesis:

    The voltage and current reading are always received together within the app, and they are sent as separate intents one after the other (current first, then voltage). But they have the same intent type (com.mooshim.mooshimeter.SAMPLE_INTENT). So my guess is that your version of Android is doing something “clever” and discarding the second intent (voltage) most of the time because it already has a pending intent with the same name.

    I modified the code to split the intent names. I hope this will get around the issue. Are you using the beta or are you building from source code? If you’re building from sourcecode, pull an update on the beta branch and try again. If you’re using the beta, it’ll be in the next release.

    You can see the code change here:
    https://github.com/mooshim/Mooshimeter-AndroidApp/commit/6491ec891917e6b2ef51e6a73c35ab756dd33b14

    ~James

    • #14718 Reply

      crada
      Participant

      Thank James! That’s great.

      So, if I understand well, now I should listent to Intents with actions
      com.mooshim.mooshimeter.CH1 and com.mooshim.mooshimeter.CH2 to grab voltages and currents. Right?

      I’m not building from code, so I’ll wait for the next beta release. Thanks!!

  • #14739 Reply

    James
    Keymaster

    Update: Duane contacted me over email and pointed out the difficulties of reading split intent names from Tasker and proposed a different solution, which is to bundle the readings from all channels in a single intent. I plan on doing that instead. This is the file that will change:

    https://github.com/mooshim/Mooshimeter-AndroidApp/blob/6491ec891917e6b2ef51e6a73c35ab756dd33b14/app/src/main/java/com/mooshim/mooshimeter/common/BroadcastIntentData.java

  • #14751 Reply

    crada
    Participant

    I agree that to bundle all the readings in a single intent would be the easiest. I look forward to see that implemented in the beta.
    Thanks!

Reply To: Broadcast Intents: How to use it???
Your information: