Preface
Like some other devs around here, I was wondering if there's a good way of forcing my phone into the Car Dock mode, which not only auto-launches Car Home application, but also turns on loudspeaker, and also allows TouchWiz to operate in landscape mode (which is kinda useful in dock).
Research (skip this section if you are not interested):
The right way to do this is via a hardware JIG (like here). I had a thing like this once, it came from a dissected Galaxy S dock, and worked fine (or at least funny).
Later on, I had to give the dock away, and got myself a Universal Samsung dock (like this one). It's fine to hold my phone and charge it, but I have already tasted the complete dock experience, so that's what I wanted to achieve...
First, I've installed an NFC tag on this dock.
Second, I used some Car Mode app from Google Play, which turned out useless: it used a UiModeManager API, which only launches Car Home, but doesn't do the auto-loudspeaker and other things.
There is a known, proper solution of achieving that functionality, which is running this command:
Code:
su -c /system/bin/am broadcast -a android.intent.action.DOCK_EVENT --ei android.intent.extra.DOCK_STATE 2
(under root, of course). The problem was, I wanted my app to send a "sticky" broadcast message (like a real dock does), so that a
Code:
registerReceiver(null, new IntentFilter(Intent.ACTION_DOCK_EVENT)).getIntExtra(Intent.EXTRA_DOCK_STATE, -1);
call would return me a correct dock state (as written in Android SDK docs). My search on how to do this got no result though.
An API call for that would be something like
Code:
sendStickyBroadcast((new Intent(Intent.ACTION_DOCK_EVENT)).putExtra(Intent.EXTRA_DOCK_STATE, Intent.EXTRA_DOCK_STATE_CAR));
but it is only possible to send this message from within a firmware... Bummer.
But hey, we can go deeper, and look at the firmware itself!
So, the Android source code shows us a file named DockObserver.java, which contains the code that sends the message I need (right now it uses sendStickyBroadcastAsUser from API Level 17, which is still "not available to applications that are not pre-installed on the system image"). Looking closer, there's an UEvent handler that actually sends it. So, basically, if we send that UEvent, it will not only imitate an effect, it will imitate the cause, and everything will work even better than I wanted it to (e.g. it can play a docking sound)! That's what my first NDK utility did:
Code:
char event[] = "ACTION=change\0DEVPATH=/devices/virtual/switch/dock\0SUBSYSTEM=switch\0SWITCH_NAME=state\0SWITCH_STATE=2";
int sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
if (sock != -1) {
struct sockaddr_nl snl;
struct iovec iov = { event, sizeof(event) };
struct msghdr msg = { &snl, sizeof(snl), &iov, 1, NULL, 0, 0 };
memset(&snl, 0, sizeof(struct sockaddr_nl));
snl.nl_family = AF_NETLINK;
snl.nl_pid = getpid();
snl.nl_groups = -1;
sendmsg(sock, &msg, 0);
close(sock);
}
The rest was simple: bundle this utility with a simple java application, which reads current dock state (as described above) and switches it via "su -c <utility> <mode>" call.
Conclusion:
So, the app itself is available in Google Play (or you can download the attached file).
Run it once, you're in a Car Dock mode. Run again, you're back to normal.
Assign its launch to an NFC sticker, and you'll get a fully-featured virtual car dock.
As a bonus, you may find the source code on GitHub.
Isn't this supposed to be in theme and application section?
Sent from my GT-I9300 using xda premium
Having tw going landscape alone would have been enough for me, thank you for all your work. I've seen several people trying to achieve this by software alone and apparently was rather tough.
Keep the good work
Sent from my GT-I9300 using xda premium
I just stumbled upon this and it looks like you solve the exact same problem I was facing. Thank you!!!
However, I do have an issue when using this app together with NFC Task Launcher. Whenever I launch the app manually, the toggle works great. However, whenever I have NFC Task Launcher either launch the application or launch the apps main activity, I receive an "Already in normal mode" message. If the device is already in car mode, I get "Already in Car Mode" instead of having it toggle back to Normal mode.
Are there any ways around this? What program do you use for NFC tags?
EDIT:
I took a look at your source and it looks like NFC Task launcher is using a different action other than "android.intent.action.MAIN" or "com.ginkage.carmodetoggle.ENABLE" when calling your app. This appears to be the problem. Other similar apps like Zandra or NFC ReTag are calling it properly. For now, I'll just use NFC ReTag to get around it.
Very handy app but when i open it it actualy open s voice first
Sent from my GT-I9300 using xda premium
Related
Hi guys
I've just started working with Silvermoon. When testing the demo app (as well as my own app) on my HD2, it works fine for 6 times, but when I start the app for the 7th time, it crashes without any message.
Has anyone else had this problem? Any ideas?
Any help would be appreciated!
Thanks, Rob
I don't have these problems on my HD. It looks like some resources are not cleaned up at application exit. Do you call 'Screen.Close();' when exiting the application?
edit:
As you're using an HD2 you don't have the libGLES_cm.dll and I assume you have copied the one of the demo. This is a software implementation and could also be the reason of running out of memory. The OpenGLES 1.x dll on GLES2 devices is called something like libGLESv1.dll. To use OpenGLES in a managed application/library the methods have to be imported from the dll and the dll name has to be defined at compile time. So, take a look at the silvermoon sources and if you find dllimport(...) using libGLES_cm.dll you'll have to replace this dll name with libGLESv1.dll (look up the correct name in your /windows directory) and rebuild framework.
(had to do that in my OpenGL test app for gles2 devices)
edit2:
Had a quick look into the silvermoon sources and for gles2 devices it has to be recompiled after changing the dll names:
in Silvermoon\OpenGL\Native\
egl.cs: change const string LibGlesDllName = "libgles_cm.dll"; to ... = "libEGL.dll"
gl.cs: change const string LibGlesDllName = "libgles_cm.dll"; to ... = "libGLESv1.dll"
(the egl dll could also be changed to "libGLESv1.dll" just in case this doesn't work)
You'll need VS2008 to compile the solution.
Hello heliosdev,
Thank you very much for your reply, I really appreciate it!!! I am calling Screen.Close() in my app and have the same problem in Silvermoon demo, so this shouldn't be the issue...
My HD2 has the following files in Windows directory:
libEGL.dll
libEGL_org.dll
libGLES_CL.dll
libGLES_CM.dll
libGLESv1_CM.dll
libGLESv2.dll
I recompiled OpenGl.dll in VS2008 with the folowing combinations & results:
libGLES_CM.dll in gl.cs & libEGL.dll in egl.cs -> app not starting at all.
libGLES_CM.dll in gl.cs & egl.cs -> app crashes at 7th start
libGLESv1_CM.dll in gl.cs & egl.cs -> app not starting at all.
libGLESv1_CM.dll in gl.cs & libEGL.dll in egl.cs -> app crashes at 7th start
Any further ideas?
I think the last version (v1 and egl) should be used on gles2 devices instead of the software renderer.
Now it's getting difficult.
Maybe try to disable Manila (Sense) restart device and test your app.
If it still fails:
Try to start another opengles app several times. (try my opengl test app (snapdragon version))
edit:
something else to try (yes, I'm getting out of ideas...)
Before Screen.Close() you could call gl.DeleteTextures() with for example an array of 100 uints starting at 1.
Disabling "HTC Sense" allows for one extra launch of the app, meaning it crashes at the 8th start attempt. Exactly the same problems using your TestOpenGL.
The only difference is, that when trying to launch my app for the 7th/8th time, the busy cursor appears shortly on the screen, as if it were starting up, but then just disappears and nothing more happens. When I launch TestOpenGL, the busy cursor appears and freezes, then nothing more happens.
ok, so it looks like resources are not cleaned up.
Try the glDeleteTextures suggestion. (even though this is called)
btw: Are you using a stock rom? Have you installed any 3d drivers (like chainfire's patch found in the sticky thread in the forum)?
Nope, unfortunately gl.DeleteTextures(1, 100) just before Screen.Close() is not helping either...
I'm using Xannys Pandora ROM which has GLTweaks integrated. However, taking into consideration the posts from codeplex, where several people are having the exact same problem on different phones (tg01, hd2), can it really be a ROM problem?
BTW: Thank you so much for taking the time to try and help!!!!
I struggle with the same issue in my own app (here) using silvermoon (7th start fails using HW renderers).
heliosdev Test app runs fine and can start numerous times without problems (gave up after 20 starts), also tried "coin toss" (here) without problems running multiple times.
Running on Miri's 6.5.x v8 without any enhancements installed.
Ok, I've created a small test app, which simply loads a form containing a Silvermoon window control, with a ChromeButton on it. On clicking the button, I call Screen.Close() to exit the app.
Testing on the Emulator works fine, but on my HD2 the 7th attempt to launch the app results in the following error: "Error on glGenTexture.". I have traced this Error to Line 37 in "Texture.cs" of the OpenGL source:
Code:
public Texture()
: base()
{
this.Name = gl.GenTexture();
[b]if (this.Name == 0) throw new OpenGlException("Error on glGenTexture.");[/b]
}
I added a line in Texture.cs to output the gl.GenTexture() uint value. On the first 6 start attempts it returns the values 1 and 2, but on the 7th it returns 0, which obviously is what causes the error.
Digging further, the GenTexture() method (which is returning 0) comes from pInvoking glGenTextures() in libgles_cm.dll.
Sadly, this is where my programming skills end... I really hope we can find a solution to this issue! It would hurt, having to give up on Silvermoon.
Looks like 'out of memory'. Call the following method before and after the GenTexture call (1285 is out of memory error).
Code:
private void CheckErrorGL(string info)
{
uint err = gl.GetError();
if (err != gl.GL_NO_ERROR)
{
MessageBox.Show(err.ToString(), "GL " + info);
}
}
Doesn't seem to be OutOfMemory... gl.GetError() is returning 0.
The exception is thrown without any glerror message box?
Run cleanRAM before calling it for the 7th time.
Correct, it's not throwing a glerror! Although, VS2008 is not showing me GL_NO_ERROR option on gl. But an if I remove the if-clause from your code (if (err != gl.GL_NO_ERROR)), the messagebox always returns 0.
Just ran a level 3 purge with cleanRAM... problem remains
The error definitions are in the namespace Silvermoon.OpenGL.Native (gl/egl)
And what does egl.GetError() return? (EGL_SUCCESS is 12288)
Code:
private void CheckErrorEGL(string info)
{
int err = egl.GetError();
if (err != egl.EGL_SUCCESS)
{
MessageBox.Show(err.ToString(), "EGL " + info);
}
}
the error definitions are surrrounded by a
#region obsolete
#if false
...
#endif
Change the false to true to access them.
get a EGL 12294 before calling gl.GenTexture()
seems to be a EGL_BAD_CONTEXT
Before calling gl.GenTexture() I'm also getting error code 12294 (EGL_BAD_CONTEXT) and afterwards 12288 (EGL_SUCCESS).
(Had a typo in my code, therefore I got the wrong result previously...)
I have the same problem with my tiny graphics engine. I think its the same problem because the egl.cs and its setup are nearly identical. So here's what I've found out:
- Its only about Egl, not about OpenGl, so forget deleteTextures etc (I've written a little test, that simply creates a display, context and surface and destorys them, no Gl calls and the same bug)
- create context creates a "Gl_Bad_Alloc" error
- everything that is allocated by egl is also destroyed
I think its also not a bug in the driver, because there is for example that ogles 2 game electopia or something like that, and this game is not affected!
I found a solution!!! I don't know about Silvermoon, but it works with my tigre engine. I can't explain it, I have no idea, and itse not the best solution, but it seems to work. Just DO NOT destroy the display, DO NOT delete context and DO NOT delete the surface. Any one have a idea why it is like that?
Phippu said:
I found a solution!!! I don't know about Silvermoon, but it works with my tigre engine. I can't explain it, I have no idea, and itse not the best solution, but it seems to work. Just DO NOT destroy the display, DO NOT delete context and DO NOT delete the surface. Any one have a idea why it is like that?
Click to expand...
Click to collapse
Amazing! That did the trick with silvermoon too. Great find, thanks!
No idea why that works though.
Sometimes it seems to be better leaving a mess instead of cleaning everything up properly
So I'll admit this is the most hands on I've attempted to be with android yet, but I was wondering if anyone could either a) tell me how to toggle bluetooth on/off programmaticaly or point me to where I can find the source code for the Power Control widget and I'll just sort it out from there.
I know this is probably terribly simple I'm just finding it a bit overwhelming to get my bearings in the source code. heh.
alcaron said:
So I'll admit this is the most hands on I've attempted to be with android yet, but I was wondering if anyone could either a) tell me how to toggle bluetooth on/off programmaticaly or point me to where I can find the source code for the Power Control widget and I'll just sort it out from there.
I know this is probably terribly simple I'm just finding it a bit overwhelming to get my bearings in the source code. heh.
Click to expand...
Click to collapse
I would just use SwitchPro
SwitchPro Video Demo
Wow that is really cool! Although it doesn't help my situation.
I am actually more interested in extending the HTC default lockscreen to add a second slider (or possibly just a button) for enabling/disabling bluetooth.
Bluetooth is SUCH a power hog but I love handsfree in my car so short of finding some way to do a crazy RFID hack to enable it automatically when I get into my car (seriously, RFID is so great but aside from tagging merch nobody uses it for anything cool, if the evo had built in RFID capabilities, oh man, LOVE) I figure I'll just live with manually enabling it, however going through the unlock etc. is a bit cumbersome.
Failing all this I plan to just set it up to enable BT when plugged in/charging. So if what I want to do can't be done, I'll just set about making a useful/functional dock that doesn't require a bunch of jerking around (fiddling with a micro USB everytime I get in the car is for the birds).
alcaron said:
Wow that is really cool! Although it doesn't help my situation.
I am actually more interested in extending the HTC default lockscreen to add a second slider (or possibly just a button) for enabling/disabling bluetooth.
Bluetooth is SUCH a power hog but I love handsfree in my car so short of finding some way to do a crazy RFID hack to enable it automatically when I get into my car (seriously, RFID is so great but aside from tagging merch nobody uses it for anything cool, if the evo had built in RFID capabilities, oh man, LOVE) I figure I'll just live with manually enabling it, however going through the unlock etc. is a bit cumbersome.
Click to expand...
Click to collapse
Ohhhhhhh I see what you're wanting Have you tried flashing CyanogenMod 6? I get INSANE battery life(like 4x what I get on a stock ROM) so having BT on all the time wouldnt really be a problem.
There are already programs for car docks in the market place that enable Bluetooth when power is connected and turns it off when disconnected.
I'm hoping to avoid needing to dock it as I currently just leave my phone in my pocket when I get in the car. So having the ability to hit power and touch/slide to enable BT would be great. I just need to figure out how to activate it programattically.
If I go the route of docking it yeah I'll probably just use Locale or something.
djR3Z said:
Ohhhhhhh I see what you're wanting Have you tried flashing CyanogenMod 6? I get INSANE battery life(like 4x what I get on a stock ROM) so having BT on all the time wouldnt really be a problem.
Click to expand...
Click to collapse
off topic:
how do you get that much battery life??!?!?! mine seems to drain pretty quickly
on topic:
i'm pretty sure you can program bluetooth to toggle on and off automatically with the app juice defender. i'm not sure though.
alcaron said:
So I'll admit this is the most hands on I've attempted to be with android yet, but I was wondering if anyone could either a) tell me how to toggle bluetooth on/off programmaticaly or point me to where I can find the source code for the Power Control widget and I'll just sort it out from there.
I know this is probably terribly simple I'm just finding it a bit overwhelming to get my bearings in the source code. heh.
Click to expand...
Click to collapse
Eclair - Release (2.1 update 1) Power Control widget source code.
http://android.git.kernel.org/?p=pl...0733fc357c35e316383ad3c11f0;hb=eclair-release
Toggling programatically :
Code:
import com.android.settings.bluetooth.LocalBluetoothManager;
private static LocalBluetoothManager mLocalBluetoothManager = null;
private static final int STATE_DISABLED = 0;
private static final int STATE_ENABLED = 1;
private static final int STATE_INTERMEDIATE = 2;
private static int getBluetoothState(Context context) {
if (mLocalBluetoothManager == null) {
mLocalBluetoothManager = LocalBluetoothManager.getInstance(context);
if (mLocalBluetoothManager == null) {
return STATE_INTERMEDIATE;
}
}
int state = mLocalBluetoothManager.getBluetoothState();
if (state == BluetoothAdapter.STATE_OFF) {
return STATE_DISABLED;
} else if (state == BluetoothAdapter.STATE_ON) {
return STATE_ENABLED;
} else {
return STATE_INTERMEDIATE;
}
}
private void toggleBluetooth(Context context) {
int state = getBluetoothState(context);
if (state == STATE_ENABLED) {
mLocalBluetoothManager.setBluetoothEnabled(false);
} else if (state == STATE_DISABLED) {
mLocalBluetoothManager.setBluetoothEnabled(true);
}
Toast.makeText(context, R.string.gadget_toggle_bluetooth, Toast.LENGTH_SHORT).show();
}
Good luck, have fun.
Hey, I'm building an app and somewhere in it I'm using the IE webbrowser control to display some info. But for some reason I can't the physical 'back' button to correspond to the webbrowser, it always just exits the app. Does anybody know how I can get around this, or actually make the 'back' button correspond to the webbrowser control? Any help is greatly appreciated.
You need to handle this your self by overriding the OnBackKeyPress method. There is also no "Back" function in the webbrowser control so you will have to store a list of all the pages the user has visited within your control and use the Navigate method to go to the last one when the user clicks back.
Sent from my 7 Pro T7576 using Board Express
Wow thank you. Is there any simple way of going about this?
I'm going to bump this.
Basically, you need to declare:
private List<string> _history = new List<string>();
Hook onto the LoadCompleted event:
http://msdn.microsoft.com/en-us/lib...ntrols.webbrowser.loadcompleted(v=VS.95).aspx
Then, within your LoadCompleted handler, do:
_history.Add(webBrowser1.Source.AbsoluteUri);
Now you need to override the OnBackKeyPress:
protected override void OnBackKeyPress(object o, EventArgs e) {
// If there is history available
if(_history.Count > 0) {
// Navigate to the item
webBrowser1.Navigate(new Uri(_history.Last());
// Remove the item from the history stack
_history.Remove(_history.Last());
// Stop the screen from executing the default back button behaviour
e.Cancel = true;
}
base.OnBackKeyPress();
}
That's all a basic outline of what you need to do. As a developer, you can fill the rest in and improve upon this yourself
You'd do better with a Stack instead of a List for the history. Note that serializing the Stack to IsolatedStorageSettings for tombstoning is problematic, but converting the Stack to a List for tombstoning works.
manicotti said:
You'd do better with a Stack instead of a List for the history. Note that serializing the Stack to IsolatedStorageSettings for tombstoning is problematic, but converting the Stack to a List for tombstoning works.
Click to expand...
Click to collapse
As you say, you would probably end up converting the stack to a list for enumeration at some stage anyway, so it'd be easier to stick with the list throughout. Plus the performance improvement would be unnoticable at best.
Sent from my 7 Pro T7576 using Board Express
I have a Pebble, which doing a great job of getting Android Notifications! I just wonder if I can do the same thing with Google Glass.
There are some notification forwarder on the Market now, however, since I am already running Tasker, so I wonder if I could use
Tasker + Google's Mirror API
to achieve same thing without running any other APP on my phone, nor on my Glass, and here it is: "Glasker"
"Glasker" encapsulated Mirror API's token and authorization process into several Tasker tasks so you only need to write simple tasker "Profile" based on trigger you want then send anything to Glass!
With "Glasker", you could:
1. Forward ANY Android notification (as far as Tasker can get) to your Glass.
2. Forward Music Track info on your Phone to Glass while playing by Phone.
3. All of communications are just between your phone, Google's cloud and your Glass. Nothing go through another server.
4. You tell me!
Before we start, here are the disclaimer:
1. As Tasker is just plain text, you can see everything how those tasks works. Please review the code before proceed and once you run the tasks, I am not responsible what happened to your phone, your glass, Google's cloud or your washing machine, etc...
2. I am NOT affliated to the author of "Tasker" nor "RESTask for Tasker". Thus I am do NOT know if any of them send your message somewhere else. Don't use this project if you suspect anything.
Okay, Here are the setup steps:
0. Install a Tasker plugin "RESTask for Tasker" https://play.google.com/store/apps/details?id=com.freehaha.restask This is used to send REST message to Google's cloud. (Tasker's internal PUT doesn't work here...)
1. Setup your OAuth2.0 Client ID and Client secret at https://console.developers.google.com/project (If you have no idea on what I am saying here, I will try to add a walk thru in 3rd post when I got time!)
2. Turn on your Glass and make sure it connected to your phone via MyGlass app. Make sure your phone and Glass can access the network.
3. Import downloaded "Glass.prj.xml" file into Tasker
4. Open task "TimeInZulu" and modify Variable Substract: %deliverytime, xxxxx according to your time zone!
In Taiwan (GMP+0800), xxxxx=8*60*60=28800
In LA, USA (GMP-0800), please change Variable Substract-->Variable add: %deliverytime, 28800
Other time zone please modify as needed or you will not hear a chime when message delivered to your Glass!
5. Run Task "Get Authorization 1" once and input your Client ID, Client secret (Those two variables will be kept in Tasker Variables in PLAIN text since it will be used later), than your default browser will fire
6. After grant yourself with the priviledge of "Glass timeline request", than you will be directed to a web page with a code. Please copy the code.
7. Return to Tasker, than run "Get Authorization 2" (hence Google's Two-Step Authorization....), than input the code you get from last step.
8. Let the Task run a while (10~20 second), then you should see a message on Glass says "My Notification forwarder Setup Completed!" (If not, lease scroll to right of timeline to see this message. It should be the 1st message)
9. Now, go back to Tasker/Profile than setup your trigger. (My default trigger are with Line, a Whatsapp like messanger very popular in Taiwan)
10. Profit!
If you find this useful, Thanks button is just a click away! Also, if you can make this project better, please also share what you modified here!
Profile explaination:
1. GlassConnected: Master switch for all sending profiles. I disable the forwarding of message if my Glass is not connected to my phone via BT directly for apparently security reason. In theory as long as both your Phone and Glass are connected to the network, you can forward message even they are at opposite side of the world!
2. SendLineMsg: Send message from Line, a Whatsapp like app wildly used in certain parts of world (4 billion active user!). You can modify this to any other messanger!
3. SendMusicInfo: Not necessary, it's just a demo to show it can send something else.
Task explaination:
1. Get Authorization 1/2: To get authorization from Google to allow access to Mirror API.
2. Remove All TimeLine Items: Utility task. As name suggests, it removes all timeline items created (only) by Glasker. It also reset several Tasker variables should you encounter problem. (No need to re-do Get Authorization)
3. Get Time Line: Used in "Remove All TimeLine Items" to get all timeline items created by Glasker
4. GetAccessToken: Utility task. Used to get new access token from Google (since token are temporarily and expires about 360 seconds). Usually you don't need to mess with this task
5. TimeInZulu: Convert local time to Zulu time. It seems Mirror API only accepts Zulu time format. (You need to modify this task based on your timezone as above step 4 or you wil not hear reminder chime when mesasge delivered
6. SendStaticCard: This task is used to send customized content to Glass.
7. SendLineMsg: Send nofication from Line app to the Glass. I update both "Boundle Cover" as will as content
8. SendMusicInfo: Send the music track info for the music playing at stock music player on your PHONE. (This is a demo of non-chimed Card send to glass)
Reserved
**Reserved**
This looks pretty cool. Sorry if I missed it, but does glass automatically turn on, visual, for each notification?
jewnersey said:
This looks pretty cool. Sorry if I missed it, but does glass automatically turn on, visual, for each notification?
Click to expand...
Click to collapse
Yes, you can make a sound when notification push to Glass. However, the Glass will not turn on the screen. (This is explicitly mentioned by Google that such ability will not be allowed in Mirror API, only for APP running on Glass itself).
What's cool here is that when you hear the notification sound, if you turn on the Glass in about 5 second (by touchpad or head-up activation), the Glass will show the notification card directly instead of the regular card with time.
The task of "SendLineMsg" is an example to have a card with notification sound, while "SendMusicInfo" doesn't have sound.
Got any way to go the other way? From Glass to phone? Would be great for voice commands for home automation.
Frunple said:
Got any way to go the other way? From Glass to phone? Would be great for voice commands for home automation.
Click to expand...
Click to collapse
Yes, it's possible to go the other way (from glass to Phone). However you need to run a HTTP server on your phone.... The whole Mirror API is two way...
I was thinking to have Tasker to enable/disable the HTTP server on phone based on the message sent (to save phone resource-->Battery when no message are needed) but don't have time to do it yet...
You are welcome to make modification here!
I don't understand step 4. I'm supposed to change variable from subtract to add?
foxdog66 said:
I don't understand step 4. I'm supposed to change variable from subtract to add?
Click to expand...
Click to collapse
It's depends on your time zone. If you are in US, you need replace the "Variable Substract" action with "Variable add" action than put your time zone difference in second.
I'm trying to use this to forward YouTube videos to glass. Getting close I think.
foxdog66 said:
I'm trying to use this to forward YouTube videos to glass. Getting close I think.
Click to expand...
Click to collapse
Any luck on this? Does the timeline card open up the correct application? Can I send myself a location from my phone and open it up with maps on glass? This would be awesome!
Does this still work without MyGlass ?
Can anyone help me with some advice. I want to create an App that is loaded and then left running while other apps are loaded. I then want it to monitor what is output to the smartphone screen and when it recognises a particular pattern or logo being displayed to do something?
Is this possible?
Anyone know how to do - hopefully with javascript?
Phil
Is it a keylogger. Of course you can record monitor all the time, but it's usually needn't. You can regularly check an app that you want to monitor wherether it's running or not, by using this code, as long as you know class name or service name.
public static boolean isMyServiceRunning(Class<?> serviceClass,Context ctx) {
ActivityManager manager = (ActivityManager)ctx.getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (serviceClass.getName().equals(service.service.getClassName())) {
return true;
}
}
return false;
}
Correct me if I'm wrong, but this sounds like a Keylogger + Screenlogger. What exactly are you trying to monitor? Your app of anything that is happening on the screen? If its the latter then I very much hope that it is not possible, otherwise that would be a big security hole if any app can simple record the screen of any other app.
Use the Accessibility Service
It requires a special permission from users but it will let you read all the content on the screen, including what users click on etc. I'm working on an app called Sesame Lock Screen that uses the Accessibility Service to make shortcuts for users based on their behavior.
B/c it's a sensitive permission we don't send any of the data back to our servers. You should probably do the same.
Let me know if I can answer more questions about this.