Skip to content

Instantly share code, notes, and snippets.

View tajchert's full-sized avatar
🏠
Working from home

Michal Tajchert tajchert

🏠
Working from home
View GitHub Profile

Send uncaught Exceptions from Android Wear to Android

This is a short Gist showing how I transmit any uncaught exceptions happening in the Wearable part of my App to the connected Smartphone/Tablet. This is necessary because Android Wear devices are not directly connected to the Internet themselves.

##Wear

  • WearApp.java
  • AndroidManifest.xml
  • ErrorService.java
@tajchert
tajchert / BuildConfSolution
Created August 15, 2014 21:42
Android Wear Build Configuration problem
If you build and deploy Android Wear app from IDE to watch directly you most likely will see Build Configuration screen and if you will clik "Run" you will get "Build Configuration is still incorrect, do you want to edit it again?"
SOLUTION
To solve it just check "Do not launch Activity" in Activity section of a "Run/Debug Configurations" of a "wear" project.
Simple like that and will save you bunch of seconds each build, minutes each day, hours each year - enjoy!
@tajchert
tajchert / scaleTopCrop
Created July 18, 2014 08:22
Crop Top of a Bitmap to particular size.
//Author: Michal Tajchert
//tajchert.pl
public Bitmap scaleTopCrop(Bitmap source, int newHeight, int newWidth) {
int sourceWidth = source.getWidth();
int sourceHeight = source.getHeight();
float xScale = (float) newWidth / sourceWidth;
float yScale = (float) newHeight / sourceHeight;
float scale = Math.max(xScale, yScale);
float scaledWidth = scale * sourceWidth;
@tajchert
tajchert / robot.js
Created December 4, 2012 20:48
RUSH, RUSH
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.turn(360);
@tajchert
tajchert / robot.js
Created December 4, 2012 20:02
CIRBOT
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();
robot.ahead(Math.floor((Math.random()*7)+4));
robot.turn(10);
};
Robot.prototype.onScannedRobot = function(ev) {
@tajchert
tajchert / robot.js
Created December 4, 2012 15:10
Primosz_PL
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(5);
robot.turn(10);
};
Robot.prototype.onScannedRobot = function(ev) {
var robot = ev.robot;
@tajchert
tajchert / robot.js
Created December 4, 2012 15:05
Primosz_PL
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.clone();