Environment.getExternalStoragePublicDirectory (Environment.DIRECTORY_DOWNLOADS);Switching on adb-over-wifi
$ adb tcpip 5555 $ adb connect 192.168.0.101The IP adress is that of the device. Turn it off:
$ adb usbTo remove a package reliably you must stop it first:
$ adb shell am force-stop com.dodo.gfxtest $ adb uninstall com.dodo.gfxtest $ adb install bin/GfxTest-debug.apkTo install an icon, put a 72x72 pix icon in res/drawable-hdpi. Then in the manifest:
<application android:icon="@drawable/myico" ... > ... </application>myico is the file name for the icon without the .png suffix. The full list is as follows
drawable | resolution | icon size |
-ldpi | 120 dpi | 36 x 36 |
-mdpi | 160 dpi | 48 x 48 |
-hdpi | 240 dpi | 72 x 72 |
-xhdpi | 320 dpi | 96 x 96 |
-xxhdpi | 480 dpi | 144 x 144 |
-xxxhdpi | 640 dpi | 192 x 192 |
-WEB | 512 x 512 |
Calling Java stuff from C.
// vm comes from the outside JavaVM *vm; // jni strangely uses double pointers, both // JavaVM and JNIEnv are already pointer types JNIEnv *env; // you need to do this only once, it provides // a context in which to run Java code. if( (*vm)->AttachCurrentThread(vm, &env, NULL)) FAIL; // find a class jclass cls= (*env)->FindClass(env,"android/os/Environment"); // from an object jclass cls= (*env)->GetObjectClass(env, obj); // to get a field value, you need the ID jfieldID field_id= (*env)->GetStaticFieldID(env, cls, "DIRECTORY_DOWNLOADS", "Ljava/lang/String;"); // this is how you get the object-valued static field jobject obj= (*env)->GetStaticObjectField(env, cls, field_id); // to call a method, you need its ID first jmethodID method_id= (*env)->GetStaticMethodID(env, cls, "getExternalStoragePublicDirectory", "(Ljava/lang/String;)Ljava/io/File;"); // The ellipsis stand for the function arguments jobject obj= (*env)->CallStaticObjectMethod(env, cls, method_id, ... ); // Non-static version jmethodID method_id= = (*env)->GetMethodID(env, cls, "getAbsolutePath", "()Ljava/lang/String;"); // Here you see a function without arguments. // If there were arguments, they would follow // method_id. jobject obj= (*env)->CallObjectMethod(env, obj2, method_id); // Each String is a Java object. You can get the UTF-8 byte // array for it using the following: jboolean iscopy; const char *chrs= (*env)->GetStringUTFChars(env, obj, &iscopy); // when you're done, release them (*env)->ReleaseStringUTFChars(env, obj,chrs); // when you're done with an object, you should release it: (*env)->DeleteLocalRef(env, obj); // when you're done with the whole Java thing, destroy the env (*vm)->DetachCurrentThread(vm);