Event listener working on background - Java for Android App Development

Android JB. I want to listen some events like onKeyDown in background (when activity is not visible). It must work with root or not, doesn't matter. How to do that?

For onKeyDown it is not possible
http://stackoverflow.com/questions/3454710/onkeydown-in-a-service-global-hot-keys/3455094#3455094

Yes it is possible through AccessibilityService. Sorry I can't paste URL for you because I'm a new user. Try to Google "AccessibilityEvent" and
"TYPE_VIEW_TEXT_CHANGED."
However, you'd need the user to enable the service in the setting manually. You can't programmatically enable accessibility service. Hope this helps you.

Related

rk-Sleep: Automatic phone switch off/on based on location.

Ok, here is the (Cell Tower ID) location based Sleep Management software (earlier called phone switcher).
Saves your battery and works automatically without any manual action once configured
Application is not memory resident so it does not keep running in the background. Does not write anything to registry etc so can be uninstalled cleanly.
Application can run in one of the following modes
• Flight Mode: System automatically switches to flight mode when you are at predefined location (Say Home) based on the time you setup. So when you are at home, say from 10:00 PM to morning 6:00 AM your phone is really sleeping so no one can call your mobile. But if you are not home, then phone remains ON even at night.
• Run Command*: You can configure separate command line applications while ‘entering’ and ‘exiting’ your Sleep Location. So if you want to perform some other actions such as enabling the sounds/vibrations/forwarding etc you need to configure this feature
Run Command* Notes:
• Run command has two settings
o Entering sleep location​o Exiting sleep location.​• Either browse for the command line application or copy paste the short cuts on the file and any command line parameters
• Some programs require you to ‘Wake Up’ the device to run, so if needed use that option
• ‘Wait for completion’ is only for advanced configurations. Most of the time it will hang the application. So use if you absolutely need it.
• You can test your run commands from the ‘Test’ menu.
Update history
Update 1.0.3
• Bug Fixed : If you were out of sleep location and returned to sleep location after 12 mid night(with in the sleep period) application would skip the current sleep.
Update 1.0.2
• Better user friendly UI added
• Now the application supports running an external application on command line.
Update 1.0.1
• Multiple locations on the schedule: If you want to set more than one location as you 'Sleep Location' you can do it now.
• Now if you were not at home at set time, system will keep polling based on the poll time you specify. So as soon as you reach home your phone will be switched off.
• If you turned on your phone manually after the rk-Sleep set it to flight mode, then your phone remains on till next scheduled sleep session
It is working on Hermes(WM6), and I have tested it on WM5 emulators. Will NOT work on WM2003.
Setup Instructions:
• You need to be at ‘Sleep Location’ to setup the application.
• In the ‘Locations’ tab, the current location box shows some numbers corresponding to your location.
• Click the button ‘Set as Sleep location’ to add current location as your sleep location. You can add multiple locations as sleep locations.
• On the ‘Schedules’ tab configure the ‘From’ and ‘To’ time fields. (You need to specify time in military time format)
• From the tab ‘Action’ choose if you want to use flight mode or Run Command (you need to set up your enter and exit actions)
• Finally click ‘Enabled’ and click the ‘Save’ menu
That’s all now you are set for ‘Sleep’. You can safely exit rk-Sleep.
The status tab would show you the last action attempt log
Note: This application requires Compact Framework 2.0
You need compact framework 2.0 installed inorder to run this application. The compact framework is already part of WM6, so if your device is WM6 skip this step. But most of the WM5 devices do not have this update. So you must download here and run the installation on your desktop (then active sync to update your device). Only after completing this step install the application.
If you like the application please show your support by replies and or donation on paypal
Download from here
Update 1.0.1
Multiple location on the schedule: If you want to set more than one location as you 'Sleep Location' you can do it now. On the sleep location box bring the context menu up, and choose 'Append to location' now add the new location to the list. You can add any number of sleep locations!
Now if you were not at home at set time, system will keep polling based on the poll time you specify. So as soon as you reach home your phone will be switched off.
If you turned on your phone manually after the rk-Sleep set it to flight mode, then your phone remains on till next scheduled sleep session
Hello,
With this program there would be still another interesting option which one to insert could.
It would thus not have to be possible the flight mode to activate automatically with enters a stored potition dependent on the time.
If someone works in a hospital, he needs to store only the position and every time it is in the hospital the flight mode switched on.
That one could not do also at others locates to use at those handys permitted or desired is I thinks there also of cemeteries.
MfG
S64
Great idea!
Is it perhaps possible to tirgger an application (or better: mortscript) upon entering a given location?
(I use mortscript to change call profiles, by copying sound files to overwrite the soundfiles I assigned as ringtones for various contacts. So if I set a "work" profile, the ringtones for different people are overwritten with a soundfile that contains silence, while others are made more discrete. It would be great to be able to automate this!)
Jörg
Instead of enabling flight mode, why not just disabling sound or enabling vibrate only mode?
Thanks
V J said:
Great idea!
Is it perhaps possible to tirgger an application (or better: mortscript) upon entering a given location?
Jörg
Click to expand...
Click to collapse
Jörg,
I do not know about mortscripts, but if i make application to run some other exe(say with some command line, Will the mortscript be able to change sound settings, call forwarding etc?
tytnguy said:
... but if i make application to run some other exe(say with some command line, Will the mortscript be able to change sound settings, call forwarding etc?
Click to expand...
Click to collapse
Yes, it should be able to do that. Also, maybe it is better to write it this way, and have your "flight mode application" written as a seperate program to be triggered by your tower-based software. In this way, others can contribute to write any other programs (as plugins) to yours. Anyway, AFAIK, Mortscript can do most of the job and or VJ (not the one above) has some nice collection that you can paired with yours.
Next you can write some scheduling software that will run an application whenever there is a 'Busy' (e.g. meeting) in your schedule (e.g. activate vibrate only mode). Then, with your tower-based software and your scheduling software, you can have a nested tower-schedule, while others can have a bluetooth-pairing based (e.g. execute software when near a paired bt device - change mode when inside your car), then you can stack all these together that will schedule your stuff based on tower-schedule-bt pairing.. WOW... too much software engineering makes you crazy.
Very nice software, but pls if You can, make a addon to change profile based on id, that would be nice. Something like: when i go to work (cell id: XX) phone change profile to vibrate/silent, but when i go back to home phone (cell id:YY) will change profile to loud.
Thx
drivex said:
Very nice software, but pls if You can, make a addon to change profile based on id, that would be nice. Something like: when i go to work (cell id: XX) phone change profile to vibrate/silent, but when i go back to home phone (cell id:YY) will change profile to loud.
Thx
Click to expand...
Click to collapse
Yes I know that is where this software will lead to(Hopefully)
But to support multiple locations the progrma gets too complex. But I know that will be a perfect applicaton!
@VJ: I think using mortscript with the tool would defeat the purpose of the tool, because with mortscript you don't need the tool (The current tower, or BTS as I should refer to it to, is available in registry I think)
@tytnguy: kudos to you, great streak with so many useful programs.
Update 1.0.2
• Better user friendly UI added
• Now the application supports running an external application on command line.
• You can configure separate command line application while ‘entering’ and ‘exiting’ your Sleep Location
More info on the main thread.
Hi,
Great Application that seems to work perfectly. I can see myself using it to help save on battery life.. and also when I enter work where I cant have the phone on.
Don't suppose you'd share how you get the tower information? I tried a method posted on the forums but it doesn't work for me and only works when the data/voice is not connected.
I tried to implement this into an application I use as a backup to give a rough location if GPS location isnt available but never managed to read a sensible string for the towers ID.
(If you'd rather not say I understand fully)
Thanks,
sam
Great!, make a profile changer based on location also, that will be awesome
Update 1.0.3
• Bug Fixed : If you were out of sleep location and returned to sleep location after 12 mid night(with in the sleep period) application would skip the current sleep.
I LOVE it, actually I've been looking for something like this every since I switched from my Nokia communicator 9000
2 suggestions
1- would it be possible to "rename" locations to something more intuitive?
2- I'd like to be able to trigger an alarm on entering a location that way if u are on a train your phone can wake u up when you reach your destination
thanks
ArcticCat said:
I LOVE it, actually I've been looking for something like this every since I switched from my Nokia communicator 9000
2 suggestions
1- would it be possible to "rename" locations to something more intuitive?
2- I'd like to be able to trigger an alarm on entering a location that way if u are on a train your phone can wake u up when you reach your destination
thanks
Click to expand...
Click to collapse
Thanks for the reply,
But right now the application just supports one location, So you are not able to do multiple locations. If you use the slot of managing only alarms its fine. But if you want to do alarm and also in some other location some other action you can not.
But i have that featrue in my list though
To do it, right now you have to set to 'Run Mode' and in the run mode specify any media file, On entering your location the media will be played.
Hi tytnguy,
found a "mini minor" bug in latest version 1.0.3...
If you just append a new location and change nothin other
the Save function don't gets active and so if you just press
OK the new location won't saved and neither the window don't
pop up asking wether you want to save or not.
So you have always to tap any other function on/off additionally
to be able to save Hope you understand this
Next step in version profiles would be great
Best regards,
Olioaglio
Olioaglio said:
Hi tytnguy,
If you just append a new location and change nothin other
the Save function don't gets active and so if you just press
OK the new location won't saved and neither the window don't
pop up asking wether you want to save or not.
So you have always to tap any other function on/off additionally
to be able to save Hope you understand this
Olioaglio
Click to expand...
Click to collapse
Understood, For now to enable the save button you can Uncheck and Check the 'Enable' checkbox as you suggested
Olioaglio said:
Next step in version profiles would be great
Olioaglio
Click to expand...
Click to collapse
I know others also requested it, but what type of 'Profile' you are asking for? Is it changes the sound profiles to change between different sound modes? Or change lot of options such as sound+wifi+bluetooth+backlight+....etc?
tytnguy said:
Understood, For now to enable the save button you can Uncheck and Check the 'Enable' checkbox as you suggested
I know others also requested it, but what type of 'Profile' you are asking for? Is it changes the sound profiles to change between different sound modes? Or change lot of options such as sound+wifi+bluetooth+backlight+....etc?
Click to expand...
Click to collapse
I would like location based profiles with different schedule times,
so that you could e.g. install a "Home location" with flightmode from
11pm to 8am (like it is now) and a second profile maybe for work
with flightmode from 12am to 1pm. Or maybe a profile with 24/7 flightmode
on a certain location. Lets say you work in a hospital and while you
enter the lcation phone would turn to flightmode. If you leave phone would
switch on again.
The wifi+bluetooth+beam etc options would be also a geat thing to include
as an option with checkboxes, so one could save even more battery at night
and in sleep location would not be any electro smog.
But for now I can live very good with the program as the main function
works like it should now. One little thing: Found out, that if you reset the
phone within schedule time and phone was turned on (manually) rk-sleep
wont turn it off again. But this may be wanted as not to nag you if you
decide to manually turn on.
Olioaglio
What is the Net Compact framework that it needs! I'm running WM5, and it doesn't work on my device and I supose it has got something to do with what I mencioned earlier. Thanks.

Kiosk Mode Problem

Hi again,
the application which I'm programming shall run in kiosk mode. Currently, I have a quite simple realization by hiding the shell parts (Taskbar, Start-Icon and SIP button), and by resizing the main window to screen size.
That works quite fine, I've additionally deactivated all of the hardware buttons.
But: The application shall access the device's phone application. Every time the phone application is active, there appears the Start-Icon and other items of the standard WCE screen.
How could I avoid this problem?
I'm working on the ARTEMIS device, Windows Mobile 5.0 and I'm programming in native c++ (Visual Studio 2005)
thanks,
Günther
Quick question:
I assume you use SHFullScreen API to hide the taskbar and stuff.
At what point do you call it?
According to documentation and from my experience you need to call it after your window becomes foreground so doing it from WM_CREATE may be too soon. Try returning the HWND from Create window and using it to call the SHFullScreen isntead of WM_CREATE handler.
You can also, move/resize/hide navigation bar window and check it in loop.
Use a Remote Spy++ to determine windows classes.
@levenum: Yes, I'm using the SHFullScreen API. Currently, I'm calling it after pressing a button to toggle full screen mode. However, this doesn't prevent the application to show the taskbar after the internal Phone application has been used. Furthermore, after using the phone, my application automatically swiches back to reduced screen mode in any case.
@THEVK: Well, this also sounds reasonable - I could already acquire the handle of the taskbar and hide/disable the window. Now I still have to think about bringing the phone application or the contacts application to the background when they aren't needed anymore. But I think I could do that by simply adding some buttons to my main application and placing them at the location of the taskbar...
thanks and cheers,
Günther
Taskbar have a code, which bring it on top always, IMO.
I think, the best solution to hide taskbar window and place your custom window there.
disable kiosk
hi a customer brings a windows mobile phone which is in a kiosk mode and he don't know the password for it and i can not take it back again is there any way that i can disable kiosk mode??
It sounds more like the phone is locked by a password than that it is a actually in "kiosk mode".
In such case there is a high possibility the reason the customer does not have the password is because it is not his phone.
But if that is not the case (and I hope so) then you should give details about what kind of phone it is (exact make and model) and describe the kiosk application that is running.
Perhaps then someone will have the answer for you.

Disable settings button

I have to prepare a device for someone who may not access the settings page, but i don't know how to do it the easy way.
Ofcource i can put in all the reg:
HKLM\ControlPanel\<app>\hide = 1
or for each app to set the group key to 4 or something.
but that means a lot of work.
My question is: is there a easy way to disable settings menu?
I think that there is no easy way - due to the nature of pocket pc OS Your work can be always characterised as "security by obscurity".
Maybe You can constantly monitor active windows and terminated unwanted process - but this approach is hard to implement and user unfriendly
properly there is an alternative way.
if i rename or delete \windows\start menu\settings it would disappear

Change background of LinearLayout

Hi all!
I have a problem when develop Android application. I want to allow user change application's background at run-time (it looks like the way we change desktop background on PC). User can select a picture that they like (via file browser) to set background. I don't know how to do that. Help me please.
Thanks for reading.
YOu should check stackoverflow.com . It is the official android support for developers.
Here is a similar question: http://stackoverflow.com/questions/2482848/how-to-change-current-theme-at-runtime-in-android
Basically you will need to create a style indicating the background to use. And in runtime you should be able to get a value from the user preferences and set the them of the activity accordingly, using setTheme in onCreate (before calling setContentView). AFAIK you will have to do this in all your activities, there's no simple way to do it for all your application, unless it is before runtime.

Martian Notifier | Tasker Integration

Bought this from Amazon for $35 (it's available from many other sites too) and have been trying to get it to work with Tasker. Finally made some headway so I'd like to share and discuss ideas -
http://www.androidauthority.com/deal-martian-notifier-smartwatch-667537/
having now used it for a couple of weeks, here is my review:
it works pretty well, does what it says on the box very reliably. and i've gotten it setup with Tasker in a way that gives me much greater control over notifications than out of the box. it also gives me 7 days of battery with almost no impact to my phone's battery life
here's what i've done:
- disabled notification access for the Martian App, so it doesn't drain my phone battery
- use Autonotification to intercept notifications for apps i want to get displayed on the watch (mailwise, whatsapp, LINE, sms, hangouts, which i do for my home screen message counter already so it is not incremental to battery drain)
- pull content from the Autonotification intercept, so i get richer (e.g. email body, mail account, sender, reply/delete actions) and more customizable content (rules based on profile, time, sender, message content, etc.) which i can then push to the watch
- simulate a notification for these apps using Tasker to send a shell command targeted only at the watch, which allows control over what icons/vibration patterns are used, even if i don't have these apps installed. also minimizes battery drain on both the watch and phone
- reconfigured the left top button to delete the last read message (high use case incidence) rather than trigger Google Now (which is a low-incidence use case for me). can be easily reconfigured to map to say music controls
- it was somewhat painful to get to this point, since it involved reverse-engineering of the Martian App using apktool, trial and error to find the right intent to trigger the watch's notifications ... so if anyone is interested, just respond and i can share more details
- i'll also want to explore more tweaks using Tasker and the watch, such as remapping the watch's screen tap action, unleashing the accelerometer to send readings to Tasker, using Tasker to send GMaps walking directions, etc ... if anyone has ideas on what is possible or useful let me know
I just got the same watch. Being a novice to Tasker, I would love to know how you have done some of what you explain. I'm particularly interested in seeing more email text being pushed to the watch.
Chiming in to say I am very interested. I have this watch and love it. My major complaint thus far is that, as an avid user of hangouts, I find my watch constantly inundated with notifications from hangouts.
Typically I have extended conversations via Hangouts with friends using my desktop computer. When this happens Hangouts understands I have focus on the chat on my PC and will not send notifications to my phone, unless the chat loses focus. Frustratingly my watch does not have this feature so I find my watch buzzes frantically whenever I start up a serious Hangouts chat with someone. The fixes are either to disable notifications for the person in question or put the watch in DND mode. Neither is desirable for obvious reasons - I would still like notifications on my watch when I am not near Google hangouts!
Any ideas on a solution for this? My hackish idea is to buy an NFC tag and write a gasket task to suppress phone notifications (and therefore watch buzzing) when my phone is placed on the NFC tag on my desk (signifying I am near my PC enough to see notifications there).
I'm not sure if there is a more elegant solution.
john1833 said:
I just got the same watch. Being a novice to Tasker, I would love to know how you have done some of what you explain. I'm particularly interested in seeing more email text being pushed to the watch.
Click to expand...
Click to collapse
to get more email text, use a notification intercept app like AutoNotification to put the text you want into a variable
then to send this text to the watch, use a Tasker shell command:
am startservice -n com.martianwatches.martianwatchnotifier/com.martianwatches.martianwatchalerts.NotificationSenderService --es "sender" "demo_email" --es "message" "%antitle: %antext"
where %antitle and %antext are fields populated by a Autonotification Notification Intercept Event. if you are familiar with Tasker and sqlite, you can even send text to your watch that is not contained in the notification. (for instance, I use sqlite to pull the full whatsapp message rather than the shortened version that appears in the notification)
the "demo_email" example just gives you the default email icon that is built into the watch's firmware. there are other icons for specifici apps, e.g. fb, whatsapp, instagram .... if you prefer another icon, decompile the Martian apk and look in the NotificationSenderService.java file under /com/martianwatches/martianwatchalerts
note: to get this to work:
- you will need to have the Martian App installed
- you do not need to have the Martian App be able to listen for notifications (since you are essentially simulating a notification being sent to the App using the shell command above). this helps to reduce my battery drain from the Martian App
while this example is just for email, the approach opens up a lot more possibilities for the watch ... which are not restricted by the Martian App's hard-coded features. let me know if this works for you
betarepeating said:
Chiming in to say I am very interested. I have this watch and love it. My major complaint thus far is that, as an avid user of hangouts, I find my watch constantly inundated with notifications from hangouts.
Typically I have extended conversations via Hangouts with friends using my desktop computer. When this happens Hangouts understands I have focus on the chat on my PC and will not send notifications to my phone, unless the chat loses focus. Frustratingly my watch does not have this feature so I find my watch buzzes frantically whenever I start up a serious Hangouts chat with someone. The fixes are either to disable notifications for the person in question or put the watch in DND mode. Neither is desirable for obvious reasons - I would still like notifications on my watch when I am not near Google hangouts!
Any ideas on a solution for this? My hackish idea is to buy an NFC tag and write a gasket task to suppress phone notifications (and therefore watch buzzing) when my phone is placed on the NFC tag on my desk (signifying I am near my PC enough to see notifications there).
I'm not sure if there is a more elegant solution.
Click to expand...
Click to collapse
I do have a solution for exactly this problem, but it's a little complicated and highly tailored to how I use my phone, watch, and pc
here's what you'll need to implement my solution:
- Tasker (of course!)
- Eventghost installed on your PC
- Some basic knowledge of Python
- Bluetooth capable PC
- Bluetooth plugin installed on Eventghost
- AutoRemote plugin installed on Eventghost
- AutoRemote installed on phone
- AutoNotification installed on phone
and here's how I am implementing it:
- Eventghost checks for the presence of my phone every 5 mins, returns 1 (detected) or 0 (not detected). If there is a change in status, Evengthost sends a message to phone via AutoRemote with newly updated status
- if I'm near my pc (i.e. my phone is near my pc), AutoRemote sets a Tasker variable WatchStatus=0. If I'm not at my pc, AutoRemote sets WatchStatus=1
- instead of relying on the Martian App to listen for notifications, I use Tasker and AutoNotification to listen for notifications and decide which ones to send to the watch
- therefore if WatchStatus=0, I'm at my pc doing something, and if a Hangouts Notification comes into my phone, I have a Tasker task which checks for WatchStatus=1 before it sends the notification to my watch (using the method described in post #4 above)
- the rules don't need to be the same for each app or notification received, so it is highly customizable. for instance, Tasker can send notifications to the watch even if WatchStatus=0 for priority senders. or, you can set different rules for WatchStatus that do not only depend on bluetooth proxmity of phone vs. PC, such as quiet hours, geolocation, wifi near, etc.
hope this helps!
Any idea how I can do similar with the SMA-Q Watch? I can get tasker to produce a notification and I have the watch app watching Tasker, but I'd like to send a command like you have here.
I have decompiled the app and I can't seem to get a message sender service to work.
Is there anything specific to look for when trying this for a different watch?
Thanks!
StuDB said:
Any idea how I can do similar with the SMA-Q Watch? I can get tasker to produce a notification and I have the watch app watching Tasker, but I'd like to send a command like you have here.
I have decompiled the app and I can't seem to get a message sender service to work.
Is there anything specific to look for when trying this for a different watch?
Thanks!
Click to expand...
Click to collapse
it should be possible to do the same thing - in your watch's android app, look in the android manifest for a service that listens for notifications. then, go into the javascipt (.java file in the decomplied app resources) to understand the syntax that the notification service uses to send messages through to the watch. finally replicate that syntax with a shell command from Tasker
Hello, Could you tell me what you did to reconfigure the top button (a short step tutorials ?) ? I was very annoyed it's stuck to using google voice, a thing I never use... Thanks
gervil said:
Hello, Could you tell me what you did to reconfigure the top button (a short step tutorials ?) ? I was very annoyed it's stuck to using google voice, a thing I never use... Thanks
Click to expand...
Click to collapse
i wrote a tiny app (noob at coding) that listened for the Google Voice Search intent that would then trigger a Tasker task (via an intent). the tasker task I can then configure for different contexts (e.g. driving ,watch connecting/disconnected, music app in foreground, etc.) to trigger different actions depending on context
wyt18, I have the Martian Notifier Watch and the Martian Notifier app installed. The app is connected to the watch and works fine. I am trying to test my ability to send a notification to the watch with Tasker. I am using your shell command, only with the two variables manually set to some random text, so the shell command is:
am startservice -n com.martianwatches.martianwatchnotifier/com.martianwatches.martianwatchalerts.Notification SenderService --es "sender" "demo_email" --es "message" "%Antitle: %Antext"
Tasker runs this fine with root, but the watch does not respond.
Any suggestions?
Thanks.
it works for me, you might want to check if you have notification access enabled for the Martian Notifier app, and if regular notifications from the phone to the watch (using the Martian app) work properly
smalis said:
wyt18, I have the Martian Notifier Watch and the Martian Notifier app installed. The app is connected to the watch and works fine. I am trying to test my ability to send a notification to the watch with Tasker. I am using your shell command, only with the two variables manually set to some random text, so the shell command is:
am startservice -n com.martianwatches.martianwatchnotifier/com.martianwatches.martianwatchalerts.Notification SenderService --es "sender" "demo_email" --es "message" "%Antitle: %Antext"
Tasker runs this fine with root, but the watch does not respond.
Any suggestions?
Thanks.
Click to expand...
Click to collapse
smalis said:
wyt18, I have the Martian Notifier Watch and the Martian Notifier app installed. The app is connected to the watch and works fine. I am trying to test my ability to send a notification to the watch with Tasker. I am using your shell command, only with the two variables manually set to some random text, so the shell command is:
am startservice -n com.martianwatches.martianwatchnotifier/com.martianwatches.martianwatchalerts.Notification SenderService --es "sender" "demo_email" --es "message" "%Antitle: %Antext"
Tasker runs this fine with root, but the watch does not respond.
Any suggestions?
Thanks.
Click to expand...
Click to collapse
I don't know if this will be of any help, but I use Tasker to create and quickly cancel a notification to send it to the watch.
So in the Notifier app, tick Tasker. Then create your Task to generate whatever text you want, stored to a variable. Then do a Notify with title %variable, and then a Notify Cancel, title %variable (to quickly remove it from your status bar).
If you want you can then export the task as an app (AppFactory), and then in the Notifier app find that rather than use Tasker as the notifying app.
Thanks, guys. wyt, notification access is indeed enabled for the app, and the app does send normal notifications to the watch with no issue. Not sure why the shell command is not working for me.
As djthorne suggests, I can resort to creating notifications with Tasker and sending them to the watch via the Martian Notifier app. Is there any advantage to using the shell command over doing that, since I can include variables in created notifications?
djthorne, have you tried testing the shell command with your watch?
djthorne said:
I don't know if this will be of any help, but I use Tasker to create and quickly cancel a notification to send it to the watch.
So in the Notifier app, tick Tasker. Then create your Task to generate whatever text you want, stored to a variable. Then do a Notify with title %variable, and then a Notify Cancel, title %variable (to quickly remove it from your status bar).
If you want you can then export the task as an app (AppFactory), and then in the Notifier app find that rather than use Tasker as the notifying app.
Click to expand...
Click to collapse
wyt18 said:
it works for me, you might want to check if you have notification access enabled for the Martian Notifier app, and if regular notifications from the phone to the watch (using the Martian app) work properly
Click to expand...
Click to collapse
smalis said:
djthorne, have you tried testing the shell command with your watch?
Click to expand...
Click to collapse
I've not tried that, but if I get some time over the weekend I'll have a play and let you know.
i do it because i think it's more efficient than creating a separate Tasker notification. and you can customize the icon so not all notifications on the watch appear the same
smalis said:
As djthorne suggests, I can resort to creating notifications with Tasker and sending them to the watch via the Martian Notifier app. Is there any advantage to using the shell command over doing that, since I can include variables in created notifications?
Click to expand...
Click to collapse
smalis said:
djthorne, have you tried testing the shell command with your watch?
Click to expand...
Click to collapse
Just tried a quick test and it worked. Copied and pasted:
am startservice -n com.martianwatches.martianwatchnotifier/com.martianwatches.martianwatchalerts.NotificationSenderService --es "sender" "demo_email" --es "message" "antitle: antext"
Into a shell, ticked root and it sent to the watch.
Tried it again, and it now works! Not sure what or if I did anything differently before.
Now to work on understanding Autonotification!
djthorne said:
Just tried a quick test and it worked. Copied and pasted:
am startservice -n com.martianwatches.martianwatchnotifier/com.martianwatches.martianwatchalerts.NotificationSenderService --es "sender" "demo_email" --es "message" "antitle: antext"
Into a shell, ticked root and it sent to the watch.
Click to expand...
Click to collapse
Sending %antextbig to the watch with Tasker, the notification gets cut off at about 108 characters, even though the big notification on the phone shows much more message text and if I flash %antextbig on the phone, I see the entire notification. I do not have character limit set in the Martian Notifier app.
Any idea why the watch does not show the entire text?
wyt18 said:
...
the "demo_email" example just gives you the default email icon that is built into the watch's firmware. there are other icons for specifici apps, e.g. fb, whatsapp, instagram .... if you prefer another icon, decompile the Martian apk and look in the NotificationSenderService.java file under /com/martianwatches/martianwatcha
...
Click to expand...
Click to collapse
Not sure if it's of use to anyone, but I decompiled the apk and looked in the NotificationSenderService.java file and got what I believe are all the available icons.
In the text file you'll have two lines per icon (except the last one). Where the line starts if (str.equals... use the bit in quotes to replace "demo_email".
The line underneath hints at the icon it will use. So if you replace "demo_email" with "com.twitter.android" you will get "SP_DISPLAY_TYPE_TWITTER", which you can assume is the Twitter icon.
Few tests I did seemed to work for each one.
wyt18 said:
i wrote a tiny app (noob at coding) that listened for the Google Voice Search intent that would then trigger a Tasker task (via an intent). the tasker task I can then configure for different contexts (e.g. driving ,watch connecting/disconnected, music app in foreground, etc.) to trigger different actions depending on context
Click to expand...
Click to collapse
I know this is an old topic but any way you could post the apk you used for this? Music controls (or anything else) would be much more useful than the Google voice button.

Categories

Resources