[Q] How can I change the interval of LocationRequest - General Questions and Answers

I set my Android application to get location notification every 5 seconds.
private LocationRequest mLocationRequest;
private LocationClient mLocationClient;
...
mLocationRequest = LocationRequest.create();
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
mLocationRequest.setInterval(5000);
mLocationRequest.setFastestInterval(5000/6);
mLocationClient.requestLocationUpdates(mLocationRequest
so - every 5 seconds, onLocationChanged is being called. This is working fine.
Now I want to change the interval to be 1 second, without calling
mLocationClient.removeLocationUpdates(this);
I can not find the way to do this.
Is it possible that you can not change the interval of a 'living' location request?
How can this be done?

Related

[Q] Lockscreen Timeout [SOLVED]

I've rooted my phone, any chance on getting a timeout for the lockscreen? I'd like to only have to put my password in every 15 minutes or so. If this is possible without an app that'd be great! My old iPhone 3g had this feature =/.
Bumping my own thread 'cause I found a solution.
I got the Unlock With WiFi app which has the option to set the lockscreen timeout (in seconds. Set mine to 15 mins = 900 secs) in the settings.
Hope this is useful to other SGS4G users!
http://forum.xda-developers.com/showthread.php?t=1014116

[TUT] [Tasker] Create a widget that periodically cycles through different messages

Hey, guys. I've been looking to use Tasker for awhile now but, it's just been laying dormant in my app drawer because I was too overwhelmed by all the options. Anyway, I finally got around to using it when I discovered a Domo-kun wallpaper that I just had to use and customise. And what I've got is in this post.
http://forum.xda-developers.com/showpost.php?p=14898952&postcount=33983
In this tutorial we will be trying to understand how to use Tasker's Minimal Text Widget Plugin and Variables. So, let's get down to it.
Objectives
Get Domo-kun to "say" stuff based on various events on the phone.
Get Domo's messages to cycle based on a preset time period.
Variables
These are basically empty labels that you must direct Tasker to fill. You can fill them with a string of characters, or with numbers and you can also perform basic math functions on them.
Minimal Text Widget Plugin
This enables Tasker to display stuff via Minimal Text Widget.
What we need
We will need a way of keeping time, so that messages will change after a specified time.
We will need a way of setting a preset message that corresponds to the battery state.
We will need a way of setting a preset message that corresponds to the wifi state.
We will need a way to tell Minimal widget when to display a message.
We will need a way to tell Minimal Widget what message it should display.
Setting a timer that will change the message after preset time.
The context for this is obviously every 'x' minutes. So we start a new profile with a Time context, and set that to repeat every 'x' minutes.
Now, we need a variable that will change after every 'x' minutes(y+1), this will eventually tell our widget when it's time to change the message. So, this will be the action for this particular context. Add a new task to the context, select Variable>>Variable Set. Let's name our variable, I will call mine %SET. The necessary action after every 'x' minutes is '%SET + 1' so this is what we will put in the "To" field. Remember to check the box "Do Math", this will treat the variable as a number, and enable us to perform the required math on it.
Let's take a look at what will happen, when this profile is active.
Every 'x' minutes, the Variable %SET will be set to %SET + 1. So, if %SET starts at 0, after 'x' minutes it will be 0 + 1; it will be 1; after another 'x' minutes it will be set to %SET + 1, 1+1; it will be 2, and so on.
You now have a variable that changes every 'x' minutes.
Setting a preset message according to the battery state.
I want to make Domo tell me how my battery is doing when it's at four different states (100%-75%, 75%-50%, 50%-25%, 25%-0%).
So, now we have four different contexts(battery ranges) in which Tasker needs to perform certain actions(Domo will say something). Let's start creating them.
For the first context(battery level 75-100) we want to display "Your battery is good". So, we will first define the context. In this case the context is a "State" in which the phone is in. Therefore our required context is in the "State" category>>Battery level, choose the range, I will choose 75 - 100. Since the message changes based on the level, we will need to set a variable here. I will call mine %BATTSTAT, and set it to "Your battery is good".
We have to repeat the steps for the other 3 battery levels. So, we create new State>>battery level profiles but, we use the SAME Variable(%BATTSTAT) for the message.
(50-74) - set %BATTSTAT to "Your battery is OK"
(25-49) - set %BATTSTAT to "Your battery is low"
(0-24) - set %BATTSTAT to "Your battery is going to die"
What is going to happen when this profile is active?
When the battery level is between 75-100 the %BATTSTAT will be "Your battery is good", when battery level hits 74, %BATTSTAT will immediately change to "Your battery is OK", and so on.
We now have a variable(%BATTSTAT) that holds a message depending on the battery level.
Setting a preset message according to wifi state.
This is pretty much the same as setting the message for battery level. The only difference is we will use a an exit task for when wifi is not connected. An Enter Task are the actions that take place when a state is entered, an Exit Task are the actions that take place when a state is exited.
So, new profile, State>>Wifi Connected, set %WIFISTAT to "Your wifi is connected", now if we don't set the %WIFISTAT Variable to change when the wifi is disconnected, it will always hold the message "Your wifi is connected". So we set an exit task for the variable %WIFISTAT to say "Your wifi is disconnected".
Okay! We now have,
%SET - A Variable that increments every 'x' minutes
%BATTSTAT - A Variable that holds a message corresponding to the battery level
%WIFISTAT - A Variable that holds a message corresponding to the wifi status
Getting tasker to communicate with Minimalistic Text Widget
This is fairly simple, all we need to do is define a variable for MTW, and set to what we want to say, in this case the message within the tasker variables (%BATTSTAT or %WIFISTAT). So, the action would be within "Plugin">>Minimalistic Text Widget. You have a field for Minimalistic Text Widget's Variable and you have a to field.
Now, we need a way to send our messages to Minimal Text Widget at the right time.
We use our Time variable to tell us what's the time. If, %SET = 0 we will send %BATTSTAT to the widget, if(after 'x' minutes) %SET = 1, we will send %WIFISTAT to the widget. Now, our next context depends on the Variable %SET, so this will be the context we coose. Event>>Variable>>Variable Set, enter the Variable(%SET) in Name field and what it will be when we perform our action (sending data to MTW) in this case, '0'. The action to perform will be, Plugin>>MTW set a Variable %DISP to %BATTSTAT.
Now we repeat this for 'x' minutes later when %SET = 1, so a new Event context has to be made, where the variable %SET = 1, and here we will send the wifi status to MTW. So, Plugin>>MTW set Variable %DISP to %WIFISTAT.
What happens here is, when %SET = 0 (at the beginning of our cycle) Tasker will send the message within %BATTSTAT to %DISP. 'x' minutes later, when %SET = 1, Tasker will send the message within %WIFISTAT to %DISP. But, wait! What happens when 'x' minutes later our time variable increments(%SET + 1 ie. 1+1 = 2)? This is a problem because we have not made a profile for %SET = 2, in relaity we don't need one because there are only two kinds of messages we want to send to MTW.
We need to reset our counter. So, we make a new Event profile for when the variable %SET is greater than 1. All we need to do is set %SET to 0.
Displaying our messages on MTW
Create your Minimalistic Text Widget, within it's "Misc" tab find Local Variable and put in the name of your MTW Variable, in this case, it is %DISP. And you're done!
___________________________________________________
This is my first attempt at writing a tutorial and also I've only been using Tasker for a couple of days, so the above procedure might not be completely optimized. Maybe our Dev/Programmer friends can enlighted us. I tried to write this tutorial not so much as a hold your hand and give you a play by play but, more as a I hope you learn something about the way Tasker works and find better uses for it. I hope it was helpful. I don't think pictures are actually necessary if people get their feet wet with Tasker but, if people think it's absolutely necessary, I will post some.

[Q] llama app make it speak current time

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

[Q] Setting up WhatsApp so I only get one sound notification per conversation?

Hello,
I was wondering if anyone knew if it's possible to make WhatsApp give me a sound notification only for the first message I recieve in a conversation, so that the rest are muted and I hear a sound only once. Because usually I recieve messages in bursts of five or so messages, and hearing the phone ring five times in 10 seconds is extremely annoying. I'd like to make it so that any time I get a message in a conversation, I'd hear the tone just once (for each conversation) and then nothing until I open up and read the messages. Thanks in advance.
+1 to this.
2 years and nobody ever found a solution. Are we the only ones annoyed by the constant beeping?
I also find it hard to believe why WhatsApp hasn't developed a feature like this in their app... Many people I talked to are also very annoyed by the smartphone vibrating and playing a notification sound 5 times in 20 seconds!
As a matter of fact, it surprises me that this post has so few replies.
WhatsApp could implement something as simple as: "Notify me only once in 5 minutes". I'm pretty sure it is very easy to implement.. Why don't they do this?
So yeah. Im late, but i think i did.
You guys know tasker app? Amazing thing.
So here we go.
First you need tasker app.
1. You'll create two variables in VAR tab, one if for counting the other one is to store the notification volume you're set in at all random moments that you can receive a text, you don't wanna restore your volume to a preset, if you put your phone on silece mode it needs to stay on silence mode after. So, i named mines "CountNot" and "ActualNotVol"
2. Creating a task, name it whatever you like.
Look for some engine symbol or options inside the task you need to configure the Collision Handling to "Abort New Task". So the code only run once until needed again.
The code goes:
>If: %CountNot EQ 0
>Variable Set: %CountNot to 1
>Variable Set: %ActualNotVol to (click on arrow and choose) %VOLN
>Wait: 3 seconds (For my notification sound complete, may vary)
>Notification Volume: Level 0 (Muting notification sounds)
>Wait: 1 Minute (The amount of time the notification will be muted, guessing the ****head will be done sending multiple text, may vary)
>Notification Volume: (click on arrow) %ActualNotVolume (Will restore the volume that it was before)
>Variable Set: %CountNot to 0 (So the task can be repeated next time)
Finish.
Go to profile, and create > Event> UI > Notification > Owner Application > WhatsApp
And select the task you just created.
Test it if possible.
I would appreciate a reply as feedback, hope it works for you too.
bebecofp said:
So yeah. Im late, but i think i did.
You guys know tasker app? Amazing thing.
So here we go.
First you need tasker app.
1. You'll create two variables in VAR tab, one if for counting the other one is to store the notification volume you're set in at all random moments that you can receive a text, you don't wanna restore your volume to a preset, if you put your phone on silece mode it needs to stay on silence mode after. So, i named mines "CountNot" and "ActualNotVol"
2. Creating a task, name it whatever you like.
Look for some engine symbol or options inside the task you need to configure the Collision Handling to "Abort New Task". So the code only run once until needed again.
The code goes:
>If: %CountNot EQ 0
>Variable Set: %CountNot to 1
>Variable Set: %ActualNotVol to (click on arrow and choose) %VOLN
>Wait: 3 seconds (For my notification sound complete, may vary)
>Notification Volume: Level 0 (Muting notification sounds)
>Wait: 1 Minute (The amount of time the notification will be muted, guessing the ****head will be done sending multiple text, may vary)
>Notification Volume: (click on arrow) %ActualNotVolume (Will restore the volume that it was before)
>Variable Set: %CountNot to 0 (So the task can be repeated next time)
Finish.
Go to profile, and create > Event> UI > Notification > Owner Application > WhatsApp
And select the task you just created.
Test it if possible.
I would appreciate a reply as feedback, hope it works for you too.
Click to expand...
Click to collapse
I think noobs like me need a video tutorial

can’t set screentime in setup! Why?

Hi, i tried to reduce my screen on time from 30 sec. down to 15. sec. but if i tap on this feature in my setup, nothing changes!!!
I can only change the value with an external app. FW is b197. Any suggestions?
edit: solved
save energy mode seems to change access.
after switching to off, the time could be set.
Same goes with certain apps that change screen on time (Floatify is an example, free version sets screen on time to 15 seconds and it can't be changed)

Categories

Resources