This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb -d shell am force-stop com.android.Settings | |
adb -d shell am startservice com.android.Settings/com.android.Settings.ServiceName | |
#list intent receivers | |
adb shell dumpsys package com.ubnt.restapi | grep intent | |
adb shell pm list packages | |
#force factory reset | |
adb shell "am broadcast -n "com.android.server/com.android.server.MasterClearReceiver" -a android.intent.action.FACTORY_RESET" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LooperThread extends Thread { | |
public Handler mHandler; | |
@Override | |
public void run() { | |
Looper.prepare(); | |
mHandler = new Handler(); | |
Looper.loop(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "#include <bogus.h>" | arm-linux-gnueabi-gcc -v -x c - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.hardware.SensorManager; | |
private SensorManager mSensorManager; | |
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); | |
List<Sensor> deviceSensors = mSensorManager.getSensorList(Sensor.TYPE_ALL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the project proguard-project.txt file see: | |
# If your project uses WebView with JS, uncomment the following | |
# and specify the fully qualified class name to the JavaScript interface | |
# class: | |
-keepclassmembers class com.me.MeWebViewHelper.MyJSInterface { | |
public *; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String ANDROID_ROOT = System.getenv("ANDROID_ROOT"); | |
String ANDROID_DATA = System.getenv("ANDROID_DATA"); | |
CA_CERTS_DIR_SYSTEM = new File(ANDROID_ROOT + "/etc/security/cacerts"); | |
CA_CERTS_DIR_ADDED = new File(ANDROID_DATA + "/misc/keychain/cacerts-added"); | |
CA_CERTS_DIR_DELETED = new File(ANDROID_DATA + "/misc/keychain/cacerts-removed"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cpiekarski.helloworld; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.io.IOException; | |
/** | |
* javac -d . HelloWorldApp.java | |
* java -cp . com.cpiekarski.helloworld.HelloWorldApp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void registerTimezoneListener() { | |
IntentFilter timezoneFilter = new IntentFilter(Intent.ACTION_TIMEZONE_CHANGED); | |
BroadcastReceiver timezoneReceiver = new BroadcastReceiver(){ | |
@Override | |
public void onReceive(Context context, Intent intent){ | |
Log.d(TAG, "TIMEZONE CHANGED!"); | |
} | |
}; | |
Context.registerReceiver(timezoneReceiver, timezoneFilter); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.pm.PackageManager; | |
import android.os.Binder; | |
import android.content.Intent; | |
class { | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
Log.v(TAG, context.getPackageManager().getNameForUid(Binder.getCallingUid())); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void registerConnectivityChange() { | |
BroadcastReceiver connectionReceiver = new BroadcastReceiver() { | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
// When just using the ConnectivityManager you can get identical intents | |
// twice within one second. So we need to use the WifiManager & ConnectivityManager | |
// to determine true state | |
if (intent.getAction().equals(WifiManager.NETWORK_STATE_CHANGED_ACTION)) { | |
NetworkInfo networkInfo = intent |