Git Product home page Git Product logo

Comments (8)

TheLastGimbus avatar TheLastGimbus commented on July 17, 2024 1

Yesss, I definitley thought of that! When I get stuff organised, there will definitley be a way for other apps to get info from freebuddy πŸ‘€

I managed to retrieve the charge from the huawei app using a logcat read

oh that's fun too!

from freebuddy.

Slalamander avatar Slalamander commented on July 17, 2024 1

Hey just a small update: I was able to use a Tasker logcat profile to get the battery levels from the widget. Not quite as straightforward as receiving a broadcast intent, but I thought you'd find it interesting nonetheless :)

I use a profile which has a logcat event, where component is set to flutter. Then the filter is BatteryData.
My task then consists of the following actions:

    Task: Freebuddy Battery Reader
    
    <test logcat message>
    
    A2: Simple Match/Regex [
         Type: Simple
         Text: %lc_text
         Match Pattern: BatteryData(levelLeft: #levelLeft, levelRight: #levelRight, levelCase: #levelCase, chargingLeft: $chargingLeft, chargingRight: $chargingRight, chargingCase: $chargingCase) ]
    
    A5: If [ %mt_match_found eq true ]
    
        A6: Variable Set [
             Name: %4iCase_battery
             To: %levelCase
             Structure Output (JSON, etc): On ]
    
        A7: Flash [
             Text: Case Charge: %levelCase%, Buds: %levelLeft%, %levelRight%
             Continue Task Immediately: On
             Dismiss On Click: On ]
    
    A8: Else
    
        A9: [X] Flash [
             Text: %mt_match_found
             Continue Task Immediately: On
             Dismiss On Click: On ]
    
    A10: End If

The most important one is the regex matching, which maps the data from the logcat to corresponding variables.
I've only just set it up, so I may find out it isn't as reliable as I think, but for now it seems to work quite well. Even better than my previous one with the Huawei app, since now I don't even have to open an app :D

from freebuddy.

Slalamander avatar Slalamander commented on July 17, 2024

It is fun, but just like the entire original app, it's rather slow and clunky haha

from freebuddy.

TheLastGimbus avatar TheLastGimbus commented on July 17, 2024

With recent widget updates, I started to check their battery in background and saving it up in shared preferences so that widget can source it

Looks like best way to leave this info open to other apps is through content provider ??: https://developer.android.com/guide/topics/providers/content-provider-basics

(tho this looks complicated af so would prefer it simpler if possible πŸ‘€ )

from freebuddy.

TheLastGimbus avatar TheLastGimbus commented on July 17, 2024

oh... https://pub.dev/packages/android_content_provider

will just have to look this up a bit πŸ˜…

from freebuddy.

Slalamander avatar Slalamander commented on July 17, 2024

ahhh I gotta say I have almost 0 experience in Android Development, so I have to admit I can't say anything about the complexity and stuff πŸ˜…
What I was thinking of regarding the feature would be to simply have the app send out an intend with for example the battery percentagedata, which it could do whenever the percentage updates for example (or whenever it's easiest to code it in). Tasker (or other apps too) should be able to receive those and the user can just do with it what they want from there.

But as said I have 0 experience and if I just suggested something that's even more complicated let me know 🀞

from freebuddy.

TheLastGimbus avatar TheLastGimbus commented on July 17, 2024

Another thing that i could use to share stuff is broadcasts: https://developer.android.com/guide/components/broadcasts

I don't want to send intent from freebuddy because that would require user to select where to send the intent and I want to keep freebuddy simple

Could you click through Tasker or smth and see which option is easier (to listen to Broadcasts or fetch from content providers ?)

from freebuddy.

Slalamander avatar Slalamander commented on July 17, 2024

If I'm not confusing terms, I think receiving a broadcast in tasker is easy to do:
under receiving intents in the docs it says tasker sets up an intent filter and receives intents from the broadcast receiver:
image

The intent filter is also mentioned on the broadcasts page you linked (See here at point 3).

Let me know if I'm mistaken here though, I'm happy to help out further😌

from freebuddy.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.