Hi guys,
i'm writing a little software for MTCD units.
It's a service that updates a widget.
In order to start automatically the service on boot I used a receiver for the android.intent.action.BOOT_COMPLETED.
Code:
<receiver
android:name=".BootReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
</intent-filter>
</receiver>
The BootReceiver launch the service.
I have an issue on the "rapid boot". When the HeadUnit turn off is off for seconds or minutes (because the service is killed during the power off process).
If it performs a rapid boot, the service does not receive any intent... (neither the QUICKBOOT_POWERON)
Instead if the HeadUnit remains off for minutes and then it performs a FULL BOOT (the long boot) the service starts perfectly.
Do you know which intent I have to "listen" in order to launch the service after a rapid boot ?
Thank you,
Salvo
Hi parisisal,
I have the same problem, do you have solve it ?
Watchwolf said:
Hi parisisal,
I have the same problem, do you have solve it ?
Click to expand...
Click to collapse
May be you could get some input here: https://forum.xda-developers.com/t/solution-start-tasker-after-head-unit-sleep.4102439/
That was a workaround which I used now around 2 years and it worked perfect. It´s not the solution you are searching for, but may be it gives some ideas.
Hi Rigattoni,
Finally I have found a different solution.
First I remove autostart block which is not more used
<receiver android:name=".autostart"
And I have added the HOME category in my main activity
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
From the documentation
This is the home activity, that is the first activity that is displayed when the device boots.
Click to expand...
Click to collapse
Perfect for my case : a simple GPS device, but I think a bad idea on a phone
Yes, I know this solution, but...
it works not for all units, as they open sometimes the last open app, instead of the launcher.
Means that you have to actively do something to get it activated.
I found something on the Russian forum for Klyde units with CSN and CSM MCU and I think it should be working even on MTC* units, but I don´t know the source code of it.
With this app you can create your own white list and in my experiments on my unit on the bench, it is not frustrating....
Yes, the Unit needs to be rooted and you need to have Magisk and a module installed, but... I always root my devices. That is the first thing I do after connecting the unit to my network.
Related
Hi
I am using llama and trying to write event whose one part need to speak the current time
I understand we can use llama variable make it speak its value (##variable name##) so want to get current time in string format in llama variable
llama doesnt have built in variables like tasker (http://tasker.dinglisch.net/userguide/en/variables.html)
so I was trying android intent and using system class of android but still not able to do it
any idea pls
can anyone answer ppl
ashishshevale said:
Hi
I am using llama and trying to write event whose one part need to speak the current time
I understand we can use llama variable make it speak its value (##variable name##) so want to get current time in string format in llama variable
llama doesnt have built in variables like tasker (http://tasker.dinglisch.net/userguide/en/variables.html)
so I was trying android intent and using system class of android but still not able to do it
any idea pls
Click to expand...
Click to collapse
Did you ever get an answer to this question as I would like to do the same.
got busy with something else
didnt got the answer
If u r a developer cant help but you want it as feature there are many such app available
ashishshevale said:
Hi
I am using llama and trying to write event whose one part need to speak the current time
I understand we can use llama variable make it speak its value (##variable name##) so want to get current time in string format in llama variable
llama doesnt have built in variables like tasker ()
so I was trying android intent and using system class of android but still not able to do it
any idea pls
Click to expand...
Click to collapse
I looked for android intents but couldn't figure it out. Even if you could get an intent to work, I don't think you can have the return value set a value for a Llama variable, it's one-way? Otherwise I'd write a background service to just translate a formatted string with SimpleDateFormat.
I use the following solution that uses Llama only, no outside apps or intents I put all the tasks into a 'time' category.
There are four variables used, one for each numeric position in a time string:
hr: hour
m1: first position of the minute count
m2: second position of the minute count
pd: period (am/pm)
Think of it as a manual digital clock. Each variable is initialized at 1:00 AM and repeats according to the appropriate frequency:
Tasks to initialize variables:
begin_hr: Between 1:00 AM and 1:01 PM - set Llama variable 'hr' to '0' every 12 hours
begin_m1: Between 1:00 AM and 12:01 AM - set Llama variable 'm1' to '-1' every 1 hour
begin_m2: Between 1:00 AM and 12:51 AM - set Llama variable 'm2' to '-1' every 10 minutes
begin_pd_am: Between 12:00 AM and 11:59 AM - set Llama variable 'pd' to 'a.m.'
begin_pd_pm: Between 12:00 AM and 11:59 AM - set Llama variable 'pd' to 'p.m.'
Tasks to increment variables:
incr_hr: Between 1:00 AM and 12:01 AM - increment Llama variable 'hr' every 1 hour
incr_m1: Between 1:00 AM and 12:51 AM - increment Llama variable 'm1' every 10 minutes
incr_m2: Between 1:00 AM and 12:59 AM - increment Llama variable 'm2' every 1 minute
At 1:00 AM, all the begin tasks run, so the variable string equals:
##hr##:##m1####m2## ##pd## = 0:-1-1 a.m.
The incr tasks are alphabetically after the begin tasks, so they run afterwards, also at 1:00 AM, so then the string equals:
##hr##:##m1####m2## ##pd## = 1:00 a.m.
Then after 1 minute, incr_m2 will repeat, making:
##hr##:##m1####m2## ##pd## = 1:01 a.m.
I usually wake up at 6:40 a.m. and I want my phone to tell me the time every 5 minutes after my alarm goes off until I leave my house so I can know if I need to pick up the pace to make it to work on time. My next tasks to do this were:
alarmed: When the next alarm is due - set Llama variable 'alarmed' to 'true'
alarmed_off: When not at Home - set Llama variable 'alarmed' to 'false'
time_check: When 'alarmed' has a value of 'true' - queue an event named 'time_say' every 5 minutes ->
time_say: When 'alarmed' has a value of 'true' and [when 'm2' has a value of '0' or when 'm2' has a value of '5'] - say '##hr##:##m1####m2## ##pd##'
alarmed 'When the next alarm is due' will only fire once, at the moment the alarm goes off, so it needs to trigger another event that will repeat, since it can't repeat because the condition will be false. I only wanted the phone to tell me the time every 5 minutes when the second place of the minutes was 0 or 5, so it wouldn't say '6:51' or '7:03'. It would sometimes start at 6:40, then repeat at 6:46, and then be off by a minute for whatever reason, maybe because of the time it took to perform the actual 'say'. That's why time_check does a queue instead of the say.
Also, I tried using the newest Google TTS high quality voices, but often the event would take minutes long because apparently it was trying to connect to a Google server to parse the text/generate the audio, so it would say '7:05 a.m.' at like 7:12. This is a problem with TTS, not Llama's 'say' action. I changed the TTS to the lower quality and it has helped.
This is such a hack... I wish Llama had some built-in variables that could translate to the SimpleDateFormat current date/time, so I could get ##h##:##mm## ##a##
Not to mention this really fills up the task history with incr_m2 running every minute.
But Llama is free, so no complaining
Have you ever tried having your phone lay on a table for some time and when you come back to pick it up, it had almost burned through the table because of the battery heat do to an app running the CPU on a constant 100%?
Or have you tried waking up two hours to late for work, because you alarm did not go off do to the phones battery running dry during the night?
Bad applications or problems with some back-end processes is a problem for most people. To get some help with this problem, I have been running the Watchdog app for the last 3 years. It is a great application that will alert you whenever an app or a process is running wild in the background. However there is one issue with this app. It only alerts you when there is a problem. This does not help much if you are to far away from the phone, if your phone is in silent mode or if you are sleeping.
I wrote the developer of the app to see if there was any plans for making a tasker plug-in so that profiles can be made to handle this. I have yet to get an answer. In the mean time, I have made a complete watchdog profile for tasker that does what the watchdog app does, only this profile will auto terminate any wild processes if the screen is turned off. If the screen is on, it will to what the watchdog app does and alert you of the problem. It could be that you was playing a game or running a benchmark, so auto terminate while the screen is on, would not be a good idea.
The profile however, will drain more battery than the watchdog app does. Because of this I have set the check interval for 15 minutes instead of the 5 minutes I used on the app. This reduces the drain to about the same amount.
And to save even more power, I have included a Data control profile that will turn off data/wifi/sync when the screen is off, as long as you are not connected to a power source or if you are downloading, uploading or streaming. In this case the profile will wait until this state changes before turning off anything. And while off, tasker will alow sync (email and such) once every 15 minutes.
Both profiles is included in the attached download below.
Important!
The watchdog profile will need a proper busybox installed with proper symlinks for sed, grep and awk. It will also need a toolbox that supports top and ps with arguments.
You can run the update script from the Busybox Installer thread to make sure that your phone will work with this profile.
Changelog (2012-11-18)
Reduced the time from where the screen turns off, to the time Data/Sync is disabled
Data/Sync will now turn back on when the screen is unlocked rather than turned on. No need to waste power if you just want to check the time or notifications (Which can be done from lock screen in Android 4.x)
Fixed the 15 minutes data check when the screen is off. It only executed once after the screen was turned off
_______________________
Wow! Your watchdog implementation looks great! Will adopt it on my phone over the weekend.
Now I have only one battery-drain-controlling dream left - being able to find out the apps holding the wakelock for too long to kill them automatically. The reason for this is that sometimes I find battery drain to go from usual 1% per hour to 10% per hour just because some badly written app has not released the wakelock.
Alte.78 said:
Wow! Your watchdog implementation looks great! Will adopt it on my phone over the weekend.
Now I have only one battery-drain-controlling dream left - being able to find out the apps holding the wakelock for too long to kill them automatically. The reason for this is that sometimes I find battery drain to go from usual 1% per hour to 10% per hour just because some badly written app has not released the wakelock.
Click to expand...
Click to collapse
Are you talking about BetterBatteryStats? I know that it tells you exactly how long since a point in time (which can be manually customized) that certain programs/tasks hold wakelocks.
But not sure about any kind of specific stratification that displays only programs that hold the lock too long to kill them automatically (assuming that's what you are wanting?).
And OP, these sound great - I'm importing them as we speak :highfive:
dk_zero-cool said:
Important!
The watchdog profile will need a proper busybox installed with proper symlinks for sed, grep and awk. It will also need a toolbox that supports top and ps with arguments.
_______________________
Click to expand...
Click to collapse
I got all excited when reading about this until I read the Important section. After watchdog everything started getting confusing . I know I read somewhere about busybox but the other terms are all new to me...could someone explain it with a little more details on what I have to get/set up in order for this to work??
2am said:
I got all excited when reading about this until I read the Important section. After watchdog everything started getting confusing . I know I read somewhere about busybox but the other terms are all new to me...could someone explain it with a little more details on what I have to get/set up in order for this to work??
Click to expand...
Click to collapse
The profile is using some linux commands to get a list of all current processes and their CPU usage. These commands needs to be available in order for the profile to work.
If you are using a custom ROM, then you are most likely to have all what is needed. Especially if you are using a more current custom ROM.
In order to test this, download a terminal app or enter an ADB shell (Hope you know what this is) and see if the command line
Code:
top -n 1 | sed -e 1,7d | grep -e '[0-9]\+%' | awk '{print $3}'
returns anything. If it does (Except errors), then you will have all that is needed.
Alternatively you could check my Better Busybox Integration thread which will make sure that your phone is setup to work with this.
dk_zero-cool said:
The profile is using some linux commands to get a list of all current processes and their CPU usage. These commands needs to be available in order for the profile to work.
If you are using a custom ROM, then you are most likely to have all what is needed. Especially if you are using a more current custom ROM.
In order to test this, download a terminal app or enter an ADB shell (Hope you know what this is) and see if the command line
Code:
top -n 1 | sed -e 1,7d | grep -e '[0-9]\+%' | awk '{print $3}'
returns anything. If it does (Except errors), then you will have all that is needed.
Alternatively you could check my Better Busybox Integration thread which will make sure that your phone is setup to work with this.
Click to expand...
Click to collapse
well I entered that command and got
invalid argument "-n". and then a bunch of other lines after that...and I checked your other thread and there's even more code language ...ugh, I think this is one of those threads that I need to leave alone because it's too much for me to handle...sucks too cause your set up sounds really awesome...thanx for trying to help me though
2am said:
well I entered that command and got
invalid argument "-n". and then a bunch of other lines after that...and I checked your other thread and there's even more code language ...ugh, I think this is one of those threads that I need to leave alone because it's too much for me to handle...sucks too cause your set up sounds really awesome...thanx for trying to help me though
Click to expand...
Click to collapse
I will make a more simple command fix for you tomorrow that will make your phone work with this without having you enter any code.
dk_zero-cool said:
I will make a more simple command fix for you tomorrow that will make your phone work with this without having you enter any code.
Click to expand...
Click to collapse
ah thank you soo much!!!
2am said:
ah thank you soo much!!!
Click to expand...
Click to collapse
I have updated the Busybox Installer script to make sure that it will work on newer devices other than MTD, and I have added a custom toolbox binary that will contain the proper options for these profiles.
Just check the first post at the buttom in the Important section. Fallow the link, download the installer and run it in your recovery. After that you can import the profiles from this thread into your Tasker application.
Trying to create a task in a Tasker like app to activate power saving mode when my battery reaches 20%. TIA!
Code:
android:label="@string/power_saving_mode_title" android:name="Settings$PowerSavingModeSettingsActivity"
fergie716 said:
Code:
android:label="@string/power_saving_mode_title" android:name="Settings$PowerSavingModeSettingsActivity"
Click to expand...
Click to collapse
Do you happen to know the name for Ultra Power Saving mode also?!
Joe0113 said:
Do you happen to know the name for Ultra Power Saving mode also?!
Click to expand...
Click to collapse
Code:
<activity android:label="@string/powersaving_ultra" android:name="Settings$UltraPowerSavingModeActivity"
fergie716 said:
Code:
<activity android:label="@string/powersaving_ultra" android:name="Settings$UltraPowerSavingModeActivity"
Click to expand...
Click to collapse
Sorry lol, but do you happen to know how I would make Tasker automatically activate Power Saving Mode? I'm trying to make it automatically activate when my battery reaches 20%.
Hi all,
For a while as I was turning on Location on my D6603 the system was asking if I wanted High Accuracy or Device only mode.
Once I mistakenly pressed "don't ask again" or something like that and chose High Accuracy. From then on every time I turn on Location it goes to that mode. BUT even if I change manually in settings the mode to Device only, every time I turn Location on again, it goes back to High Accuracy.
QUESTION : how can I change default mode to Device Only or alternatively go back to having the question asked the mode I want each time?
I want that because High accuracy is not so helpful + much more greedy with battery.
Thanks!
Hi all,
I ended up finding two solutions on android.stackexchange:
- Rooted: edit this file: data > data > com.google.android.gms > shared_prefs > nlp-prefs.xml
Change the value of confirmNlp to true. <boolean name="confirmNlp" value="false" />
- Not rooted :if willing to sacrifice third-part apps' data associated with their Google account, can consider clearing data of Play services' app as a solution. Set location mode to Device only for once, disable location mode, launch Settings app → Apps → All apps → Google Play services → Force stop → Manage Space → Clear data → Force stop again → optionally reboot.
regards!
I have multiple Androids with Bluetooth, 8, 9, 10.
I have multiple commercial Bluetooth devices, keyboard, heart monitor.
I have multiple homemade Bluetooth devices.
I can read battery level just fine by rolling my own app and reading GATT service 0x180f, characteristic 0x2a19.
I have never seen battery level under Settings.apk, "Device details" for anything.
No, I don't want an app or a battery icon on the status bar. I'd just like the battery level to be there in Settings.
I did a quick dive in Settings.apk and I see that the sub-layout is advanced_bt_entity_sub.xml
The code is in com.android.settings.bluetooth.AdvancedBluetoothDetailsHeaderController
In updateSubLayout() there is a bunch of stuff about "untethered headsets".
Am I missing something? Is there something to be enabled? Did Google lock this down for non-headsets? Should I keep diving?
Edit: I just remembered that I did have a pair of Bluetooth headphones. I paired them and the battery level popped up. Unless you have "Phone calls" enabled you don't get to see the battery. What kind of stupidity is this?
"settings_ui/bt_advanced_header_enabled" is used in the config settings (but not present), but the default on query is true anyway.
Edit: Oops, the "namespace" is not bluetooth.