Interested in toggling a value in the build.prop - Java for Android App Development

So in my toolkit, id like to design an activity where I could point it towards certain lines in the build.prop to allow a user to easily toggle, for instance this line
qemu.hw.mainkeys=0
So, in the layout xml, lets say it had "Enable Nav Bar" and a "Toggle Button" for on/off
Where would i start in developing such a feature?

You create a ToggleButton and whenever it is clicked, you change the line.
What is your problem?

nikwen said:
You create a ToggleButton and whenever it is clicked, you change the line.
What is your problem?
Click to expand...
Click to collapse
My concerns are wouldnt I need to add ro permissions on the prop before toggling and a reboot action to apply

I think your device needs to be rooted to be able to write to the build.prop file. You do not need root access to read it though

I'm from mobile and i can't post some code but i will give you some hints
To edit build.prop programmatically first you ne ed to be rooted then you can use the shell command "sed" to exchange values. Take a look at AOKP settings source on github and look for density changer class
If you want to import various build properties you can use fileinputstream and read the file line by line then let the app create listview custom items for every line in the file (you need a custom adapter) .
Sorry if this post it's not really useful but i will edit this when at PC
Sent from my HTC One X using Tapatalk 4 Beta

Thankyou for the tip! The answer might of been infront of my face possibly...
Sent from my 9300 using xda app-developers app

xcesco89 said:
I'm from mobile and i can't post some code but i will give you some hints
To edit build.prop programmatically first you ne ed to be rooted then you can use the shell command "sed" to exchange values. Take a look at AOKP settings source on github and look for density changer class
If you want to import various build properties you can use fileinputstream and read the file line by line then let the app create listview custom items for every line in the file (you need a custom adapter) .
Sorry if this post it's not really useful but i will edit this when at PC
Sent from my HTC One X using Tapatalk 4 Beta
Click to expand...
Click to collapse
I Wrote something up but I keep getting force closes "Not a java code monkey yet, still learning" and Ill post here what I have when I get to my pc later. Maybe you can see what Im missing or did wrong. What I did is I have a preference screen similiar to AOKP density changer class. What Im going for is a PreferenceList that you click and your values are Enable or Disabled and another preference to reboot to apply settings. Im wanting to allow the user to enable and disable the Navigation Bar by toggling it through the build.prop. If this works, I want to add more toggles custom values like change your phone model, Screen Density, build number, ect; but figured Id start with something simpler first and see if it works.
Sent from my Alps9300 using Tapatalk

Nx Biotic said:
I Wrote something up but I keep getting force closes "Not a java code monkey yet, still learning" and Ill post here what I have when I get to my pc later. Maybe you can see what Im missing or did wrong. What I did is I have a preference screen similiar to AOKP density changer class. What Im going for is a PreferenceList that you click and your values are Enable or Disabled and another preference to reboot to apply settings. Im wanting to allow the user to enable and disable the Navigation Bar by toggling it through the build.prop. If this works, I want to add more toggles custom values like change your phone model, Screen Density, build number, ect; but figured Id start with something simpler first and see if it works.
Sent from my Alps9300 using Tapatalk
Click to expand...
Click to collapse
this is the method you need:
Code:
private void setLcdDensity(int newDensity) {
Helpers.getMount("rw");
new CMDProcessor().su.runWaitFor("busybox sed -i 's|ro.sf.lcd_density=.*|"
+ "ro.sf.lcd_density" + "=" + newDensity + "|' " + "/system/build.prop");
Helpers.getMount("ro");
}
( method took from here : https://github.com/TeamBAKED/packag...aked/romcontrol/fragments/DensityChanger.java )
newDensity is the int/string you let the user set ( you can use a seekbar or a dialog or what you prefer)
you have also CMDProcessor().su.runWaitFor : just use the classes you can find here : https://github.com/TeamBAKED/packag...11bca71808c9143/src/com/baked/romcontrol/util
just add these classes in your project ( these are to simplify your life when you need to use android terminal [ remember to give credits on your app! ] )
Now, you can use various types of views and methods to show to the user all the available props:
- manually add every view for every line in your build.prop ( this will probably limit the compatibility with other devices and make your app "laggy" due to "gazilions" views )
- use a blank linearLayout and inflate a "row view" for every line in build.prop:
read file line by line and import every line in an ArrayList:
Code:
ArrayList<String> Tokens = new ArrayList<String>();
try {
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream("/system/build.prop");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
// Read File Line By Line
while ((strLine = br.readLine()) != null) {
strLine = strLine.trim();
if ((strLine.length()!=0)) {
String[] names = strLine.split("\\s+");
Tokens.add(names[0]);
}
}
for (String s : Tokens) {
//System.out.println(s);
//Log.d("NNNNNNNNNNNNNNNNNN", s);
}
// Close the input stream
in.close();
} catch (Exception e) {// Catch exception if any
System.err.println("Error: " + e.getMessage());
}
names = new String[Tokens.size()-1];
names = Tokens.toArray(names);
ArrayList<String> value = new ArrayList<String>();
try {
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream("/sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
// Read File Line By Line
while ((strLine = br.readLine()) != null) {
strLine = strLine.trim();
if ((strLine.length()!=0)) {
String[] val = strLine.split("\\s+");
value.add(val[1]);
}
}
for (String s : value) {
//System.out.println(s);
//Log.d("NNNNNNNNNNNNNNNNNN", s);
}
// Close the input stream
in.close();
} catch (Exception e) {// Catch exception if any
System.err.println("Error: " + e.getMessage());
}
values = new String[value.size()-1];
values = value.toArray(values);
LineNumberReader lnr = null;
try {
lnr = new LineNumberReader(new FileReader(new File("/sys/devices/system/cpu/cpu0/cpufreq/UV_mV_table")));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
lnr.skip(Long.MAX_VALUE);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int num = lnr.getLineNumber();
Log.d("LINES", ""+num);
int i = 0;
//now inflate a specific view for every line
// you can also filter every item for example by reading the string and inflating a different layout using an if statement
for (String s : names) {
LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View v = inflater.inflate(R.layout.uvrow, null, true);
TextView text0 = (TextView) v.findViewById(R.id.text0);
ImageButton back0 = (ImageButton) v.findViewById(R.id.back0);
final EditText edit0 = (EditText) v.findViewById(R.id.edit0);
ImageButton fwd0 = (ImageButton) v.findViewById(R.id.fwd0);
text0.setText(s);
parentGroup.addView(v);
edit0.setText(values[i]);
/*
* if you need to set listeners and actions insert them inside this loop!
*/
}
if you need more informations, take a look at my code on github ( was my first "really useful" app ): https://github.com/cesco89/CustomSettings/blob/master/src/com/cesco/customsettings/UVTable.java
it's not perfect, could be tricky, but i can't post all the code here

This Is what I put together...Excuse any errors in java...Im new at this. When I start this fragment, I get a force close. What did I do?
Code:
package com.bionx.res.catalyst;
import android.content.Context;
import android.os.Bundle;
import android.os.PowerManager;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceFragment;
import com.bionx.res.R;
import com.bionx.res.helpers.CMDProcessor;
import com.bionx.res.helpers.Helpers;
public abstract class Navbar extends PreferenceFragment implements OnPreferenceChangeListener {
Preference mReboot;
ListPreference mStockValue;
int newStockValue;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.navbarchanger);
mStockValue = (ListPreference) findPreference("stock_value");
mStockValue.setOnPreferenceChangeListener(this);
mReboot = findPreference("reboot");
}
public boolean onPreference(Preference preference) {
if (preference == mReboot) {
PowerManager pm = (PowerManager) getActivity()
.getSystemService(Context.POWER_SERVICE);
pm.reboot("Setting Navbar");
}
return false;
}
[user=439709]@override[/user]
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mStockValue) {
newStockValue = Integer.parseInt((String) newValue);
setNavbarValue(newStockValue);
mStockValue.setSummary(getResources().getString(R.string.navbar_changer) + newStockValue);
return true;
}
return false;
}
private void setNavbarValue(int newNavbar) {
Helpers.getMount("rw");
new CMDProcessor().su.runWaitFor("busybox sed -i 's|qemu.hw.mainkeys=.*|"
+ "qemu.hw.mainkeys" + "=" + newNavbar + "|' " + "/system/build.prop");
Helpers.getMount("ro");
}
}
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<Preference
android:title="System Properties"
android:summary="User System Tweaks" />
<ListPreference
android:entries="@array/navbar_stock_entries"
android:entryValues="@array/navbar_stock_values"
android:key="stock_value"
android:title="NavBar Enabler"
android:summary="Toggle the system navbar" />
<Preference
android:key="reboot"
android:title="Reboot"
android:summary="Applies tweaks and reboots" />
</PreferenceScreen>
Where I launch the fragment.
Code:
...
<header
android:fragment="com.bionx.res.catalyst.Navbar"
android:icon="@drawable/ic_changelog"
android:title="System Ui Tweaks"
android:summary="Developers soup of the week" />
...

Nx Biotic said:
This Is what I put together...Excuse any errors in java...Im new at this. When I start this fragment, I get a force close. What did I do?
Code:
package com.bionx.res.catalyst;
import android.content.Context;
import android.os.Bundle;
import android.os.PowerManager;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceFragment;
import com.bionx.res.R;
import com.bionx.res.helpers.CMDProcessor;
import com.bionx.res.helpers.Helpers;
public abstract class Navbar extends PreferenceFragment implements OnPreferenceChangeListener {
Preference mReboot;
ListPreference mStockValue;
int newStockValue;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.navbarchanger);
mStockValue = (ListPreference) findPreference("stock_value");
mStockValue.setOnPreferenceChangeListener(this);
mReboot = findPreference("reboot");
}
public boolean onPreference(Preference preference) {
if (preference == mReboot) {
PowerManager pm = (PowerManager) getActivity()
.getSystemService(Context.POWER_SERVICE);
pm.reboot("Setting Navbar");
}
return false;
}
[user=439709]@override[/user]
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mStockValue) {
newStockValue = Integer.parseInt((String) newValue);
setNavbarValue(newStockValue);
mStockValue.setSummary(getResources().getString(R.string.navbar_changer) + newStockValue);
return true;
}
return false;
}
private void setNavbarValue(int newNavbar) {
Helpers.getMount("rw");
new CMDProcessor().su.runWaitFor("busybox sed -i 's|qemu.hw.mainkeys=.*|"
+ "qemu.hw.mainkeys" + "=" + newNavbar + "|' " + "/system/build.prop");
Helpers.getMount("ro");
}
}
Code:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<Preference
android:title="System Properties"
android:summary="User System Tweaks" />
<ListPreference
android:entries="@array/navbar_stock_entries"
android:entryValues="@array/navbar_stock_values"
android:key="stock_value"
android:title="NavBar Enabler"
android:summary="Toggle the system navbar" />
<Preference
android:key="reboot"
android:title="Reboot"
android:summary="Applies tweaks and reboots" />
</PreferenceScreen>
Where I launch the fragment.
Code:
...
<header
android:fragment="com.bionx.res.catalyst.Navbar"
android:icon="@drawable/ic_changelog"
android:title="System Ui Tweaks"
android:summary="Developers soup of the week" />
...
Click to expand...
Click to collapse
please post the Log you get on Eclipse !
the log will tell you exactly where the error is

Related

Help with saving gestures!

Currently, i'm making an application that involves using GestureOverlayView. I've already created some default gestures using the GestureBuilder and have copied them into my res/raw folder in my application. My application also does customization, meaning that the user can create his or her own gestures and save them. I've read that it's impossible for me to just save the additionally made gestures from the users to the res/raw folder. I was told that i have some optionals: ExternalStorage (to SD card), InternalStorage, and SharedPreferences. Which method is probably the more optimal choice?
I've tried using these codes:
gestureLib.addGesture(scName.getText().toString(), gesture);
gestureLib.save();
setResult(RESULT_OK);
in an attempt to save them. Even though the gestures do save, but when i restart the application, they're gone. Please help! Thanks so much!
rx24race said:
Currently, i'm making an application that involves using GestureOverlayView. I've already created some default gestures using the GestureBuilder and have copied them into my res/raw folder in my application. My application also does customization, meaning that the user can create his or her own gestures and save them. I've read that it's impossible for me to just save the additionally made gestures from the users to the res/raw folder. I was told that i have some optionals: ExternalStorage (to SD card), InternalStorage, and SharedPreferences. Which method is probably the more optimal choice?
I've tried using these codes:
gestureLib.addGesture(scName.getText().toString(), gesture);
gestureLib.save();
setResult(RESULT_OK);
in an attempt to save them. Even though the gestures do save, but when i restart the application, they're gone. Please help! Thanks so much!
Click to expand...
Click to collapse
I haven't used gestures so far but for the saving:
In your SharedPreferences you can only save the standard types like int or string. I'm guessing you don't want to convert the gesture to string and backwards, so I'd say external storage in a folder with the name of your app(so the user can manually delete it) but you could also save the file in your app directory.
Look at This question , he uses the gesture library and saves it to the file with
Code:
GestureLibrary store = GestureLibraries.fromFile(mStoreFile);
store.addGesture("Gesture Password", mGesture);
store.save();
My application successfully saves now, but there's still a consistent problem. When i restart the application, the saved gestures are gone. Why is that?
rx24race said:
My application successfully saves now, but there's still a consistent problem. When i restart the application, the saved gestures are gone. Why is that?
Click to expand...
Click to collapse
When you restart your app, everything in its ram will be gone, so you always need to load the saved file and then import the gestures to the library again probably.
You'd want to do that in the onCreate() or onRestart().
In the above example,
Code:
store.load();
Is used to do that
It works now. Thanks a lot. I'm assuming that these gestures are being saved in the application itself, since that i can't find them in the SD card. Thanks for your time, by the way.
It works now. Thanks a lot. I'm assuming that these gestures are being saved in the application itself, since that i can't find them in the SD card. Thanks for your time, by the way.
Click to expand...
Click to collapse
Glad I could help you
BUMP! I've been struggling with a problem that i newly encountered. What i want to do is, i want to create a folder in the external directory and save ALL the gestures that the user creates. But the thing is, every time i save the gesture, it overwrites the existing one. How do i create a folder and put the new ones in it? Any help or hints would be nice
rx24race said:
BUMP! I've been struggling with a problem that i newly encountered. What i want to do is, i want to create a folder in the external directory and save ALL the gestures that the user creates. But the thing is, every time i save the gesture, it overwrites the existing one. How do i create a folder and put the new ones in it? Any help or hints would be nice
Click to expand...
Click to collapse
You've got to use a different string for every gesture in that line:
Code:
store.addGesture("this should be a different string every time", mGesture);
Then you should be able to put them into one file.
nikwen said:
You've got to use a different string for every gesture in that line:
Code:
store.addGesture("this should be a different string every time", mGesture);
Then you should be able to put them into one file.
Click to expand...
Click to collapse
I definitely have a different name for the every gesture that i save
Here's the code:
Code:
package com.epicunlock.rx24race;
import java.io.File;
import java.util.ArrayList;
import android.app.Activity;
import android.gesture.Gesture;
import android.gesture.GestureLibraries;
import android.gesture.GestureLibrary;
import android.gesture.GestureOverlayView;
import android.gesture.GestureOverlayView.OnGesturePerformedListener;
import android.gesture.Prediction;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.widget.EditText;
import android.widget.Toast;
public class createShortcut extends Activity implements
OnGesturePerformedListener {
boolean found = false;
EditText scName;
GestureOverlayView gestures;
GestureLibrary lib;
File mStoreFile;
[user=439709]@override[/user]
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.createshortcutlayout);
scName = (EditText) findViewById(R.id.etName);
gestures = (GestureOverlayView) findViewById(R.id.gestures);
gestures.addOnGesturePerformedListener(this);
mStoreFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/com.epicunlock.rx24race");
if (!mStoreFile.exists()) {
mStoreFile.mkdirs();
}
lib = GestureLibraries.fromFile(mStoreFile);
lib.load();
}
[user=439709]@override[/user]
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
// TODO Auto-generated method stub
found = false;
ArrayList<Prediction> predictions = lib.recognize(gesture);
for (String s : lib.getGestureEntries()) {
Log.v("GESTURE", s);
}
Log.v("TAG", "Gesture has been detected");
for (Prediction p : predictions) {
Log.v("TAG", p.toString());
Log.v("^ Score", "" + p.score);
}
for (Prediction p : predictions) {
if (p.score > 2.0) {
Toast.makeText(this, p.name, Toast.LENGTH_SHORT).show();
found = true;
}
}
if (!found) {
Log.v("TAG", "Gesture has been saved");
Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show();
lib = GestureLibraries.fromFile(mStoreFile);
lib.addGesture(scName.getText().toString(), gesture);
lib.save();
setResult(RESULT_OK);
}
}
}
As you can see, i have every gesture named after its own unique scName (EditText).
What's happening right now is that i successfully creates a folder name "com.epicunlock.rx24race" inside Android/data, but nothing is ever saved in it
rx24race said:
I definitely have a different name for the every gesture that i save
Here's the code:
Code:
package com.epicunlock.rx24race;
import java.io.File;
import java.util.ArrayList;
import android.app.Activity;
import android.gesture.Gesture;
import android.gesture.GestureLibraries;
import android.gesture.GestureLibrary;
import android.gesture.GestureOverlayView;
import android.gesture.GestureOverlayView.OnGesturePerformedListener;
import android.gesture.Prediction;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.widget.EditText;
import android.widget.Toast;
public class createShortcut extends Activity implements
OnGesturePerformedListener {
boolean found = false;
EditText scName;
GestureOverlayView gestures;
GestureLibrary lib;
File mStoreFile;
[user=439709]@override[/user]
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.createshortcutlayout);
scName = (EditText) findViewById(R.id.etName);
gestures = (GestureOverlayView) findViewById(R.id.gestures);
gestures.addOnGesturePerformedListener(this);
mStoreFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/com.epicunlock.rx24race");
if (!mStoreFile.exists()) {
mStoreFile.mkdirs();
}
lib = GestureLibraries.fromFile(mStoreFile);
lib.load();
}
[user=439709]@override[/user]
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
// TODO Auto-generated method stub
found = false;
ArrayList<Prediction> predictions = lib.recognize(gesture);
for (String s : lib.getGestureEntries()) {
Log.v("GESTURE", s);
}
Log.v("TAG", "Gesture has been detected");
for (Prediction p : predictions) {
Log.v("TAG", p.toString());
Log.v("^ Score", "" + p.score);
}
for (Prediction p : predictions) {
if (p.score > 2.0) {
Toast.makeText(this, p.name, Toast.LENGTH_SHORT).show();
found = true;
}
}
if (!found) {
Log.v("TAG", "Gesture has been saved");
Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show();
lib = GestureLibraries.fromFile(mStoreFile);
lib.addGesture(scName.getText().toString(), gesture);
lib.save();
setResult(RESULT_OK);
}
}
}
As you can see, i have every gesture named after its own unique scName (EditText).
What's happening right now is that i successfully creates a folder name "com.epicunlock.rx24race" inside Android/data, but nothing is ever saved in it
Click to expand...
Click to collapse
As far as I know the file you save it to mustn't be a directory, but a file.
Try that:
Code:
mStoreFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/com.epicunlock.rx24race");
if (!mStoreFile.exists()) {
mStoreFile.mkdirs();
}
[COLOR="Red"]File gestureFile = new File(mStoreFile, "gestures");
lib = GestureLibraries.fromFile(gestureFile);[/COLOR]
lib.load();
and
Code:
if (!found) {
Log.v("TAG", "Gesture has been saved");
Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show();
[COLOR="Red"]File gestureFile = new File(mStoreFile, "gestures");
lib = GestureLibraries.fromFile(gestureFile);[/COLOR]
lib.addGesture(scName.getText().toString(), gesture);
lib.save();
setResult(RESULT_OK);
}
nikwen said:
As far as I know the file you save it to mustn't be a directory, but a file.
Try that:
Code:
mStoreFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/com.epicunlock.rx24race");
if (!mStoreFile.exists()) {
mStoreFile.mkdirs();
}
[COLOR="Red"]File gestureFile = new File(mStoreFile, "gestures");
lib = GestureLibraries.fromFile(gestureFile);[/COLOR]
lib.load();
and
Code:
if (!found) {
Log.v("TAG", "Gesture has been saved");
Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show();
[COLOR="Red"]File gestureFile = new File(mStoreFile, "gestures");
lib = GestureLibraries.fromFile(gestureFile);[/COLOR]
lib.addGesture(scName.getText().toString(), gesture);
lib.save();
setResult(RESULT_OK);
}
Click to expand...
Click to collapse
I've tried something similar to this before too, but the same problem still exists. it keeps overwriting the previous one. It's never able to save multiple gestures.
What i have:
Code:
package com.epicunlock.rx24race;
import java.io.File;
import java.util.ArrayList;
import android.app.Activity;
import android.gesture.Gesture;
import android.gesture.GestureLibraries;
import android.gesture.GestureLibrary;
import android.gesture.GestureOverlayView;
import android.gesture.GestureOverlayView.OnGesturePerformedListener;
import android.gesture.Prediction;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.widget.EditText;
import android.widget.Toast;
public class createShortcut extends Activity implements
OnGesturePerformedListener {
boolean found = false;
EditText scName;
GestureOverlayView gestures;
GestureLibrary lib, storage;
File path;
[user=439709]@override[/user]
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.createshortcutlayout);
scName = (EditText) findViewById(R.id.etName);
gestures = (GestureOverlayView) findViewById(R.id.gestures);
gestures.addOnGesturePerformedListener(this);
path = new File(Environment.getExternalStorageDirectory() + "/Android/data/com.epicunlock.rx24race/");
if (!path.exists()) {
path.mkdirs();
}
File gestureFile = new File(path, "gestures");
lib = GestureLibraries.fromFile(gestureFile);
lib.load();
}
[user=439709]@override[/user]
public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
// TODO Auto-generated method stub
found = false;
ArrayList<Prediction> predictions = lib.recognize(gesture);
for (String s : lib.getGestureEntries()) {
Log.v("GESTURE", s);
}
Log.v("TAG", "Gesture has been detected");
for (Prediction p : predictions) {
Log.v("TAG", p.toString());
Log.v("^ Score", "" + p.score);
}
for (Prediction p : predictions) {
if (p.score > 2.0) {
Toast.makeText(this, p.name, Toast.LENGTH_SHORT).show();
found = true;
}
}
if (!found) {
Log.v("TAG", "Gesture has been saved");
Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show();
File gestureFile = new File(path, "gestures");
lib = GestureLibraries.fromFile(gestureFile);
lib.addGesture(scName.getText().toString(), gesture);
lib.save();
setResult(RESULT_OK);
}
}
}
I just fixed the problem: "Can't save multiple gestures."
This is how i fixed it. But can anyone tell me what difference it made?
Code:
[user=439709]@override[/user]
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.createshortcutlayout);
scName = (EditText) findViewById(R.id.etName);
gestures = (GestureOverlayView) findViewById(R.id.gestures);
gestures.addOnGesturePerformedListener(this);
path = new File(Environment.getExternalStorageDirectory() + "/Android/data/com.epicunlock.rx24race/");
if (!path.exists()) {
path.mkdirs();
}
[B]if (lib == null) {
gestureFile = new File(path, "gestures");
lib = GestureLibraries.fromFile(gestureFile);
}[/B]
lib.load();
}

[Q] Copy Image from Gallery Share (Send To) menu

Moderators... It says I am breaking the rules by asking a question and to ask in the Q&A... But the title of this is "Coding Discussion, Q&A, and Educational Resources" I am not breaking the rules intentionally, I just don't know where else to put this. This is a Coding Question, not a General Question that I would think would get buried and or lost in the General Q&A forum. Please move if you feel I am incorrect.
Hello All, I was hoping someone could help me.
I am trying to create an app that will hide pictures. I want to be able to Pick my App from the Share (Send To) menu from the Users Gallery and have it copy the file to a Directory I have created on my SDCard and then ultimately delete the file from the current location.
Here is what I have so far, but when I pick my app from the Share menu, it crashes the Gallery app. So... I can't even see any errors in my LogCat to even try and troubleshoot my issue.
Can someone point me to a working example of how to do this (I have searched the internet until I am blue in the face) or... I hate to say it... Fix my Code?
Any Help would be appreciated... Thanks!!
Code:
package com.company.privitegallery;
import android.app.Activity;
import android.content.ContentValues;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
public class SendToDo extends Activity {
File sdCardLoc = Environment.getExternalStorageDirectory();
File intImagesDir = new File(sdCardLoc,"/DCIM/privgal/.nomedia");
private static final int CAMERA_REQUEST = 1888;
private String selectedImagePath;
String fileName = "capturedImage.jpg";
private static Uri mCapturedImageURI;
[user=439709]@override[/user]
public void onCreate(Bundle savedInstanceState) {
// Get intent, action and MIME type
Intent intent = getIntent();
String action = intent.getAction();
String type = intent.getType();
if (Intent.ACTION_SEND.equals(action) && type != null) {
if ("text/plain".equals(type)) {
handleSendText(intent); // Handle text being sent
} else if (type.startsWith("image/")) {
handleSendImage(intent); // Handle single image being sent
try {
GetPhotoPath();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
if (type.startsWith("image/")) {
handleSendMultipleImages(intent); // Handle multiple images being sent
}
} else {
// Handle other intents, such as being started from the home screen
}
//...
}
void handleSendText(Intent intent) {
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
if (sharedText != null) {
// Update UI to reflect text being shared
}
}
void handleSendImage(Intent intent) {
Uri imageUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
if (imageUri != null) {
// Update UI to reflect image being shared
}
}
void handleSendMultipleImages(Intent intent) {
ArrayList<Uri> imageUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
if (imageUris != null) {
// Update UI to reflect multiple images being shared
}
}
public void GetPhotoPath() throws IOException {
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.TITLE, fileName);
mCapturedImageURI = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, mCapturedImageURI);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
copy(fileName, intImagesDir);
}
[user=439709]@override[/user]
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == CAMERA_REQUEST) {
selectedImagePath = getPath(mCapturedImageURI);
Log.v("selectedImagePath: ", ""+selectedImagePath);
//Save the path to pass between activities
try {
copy(selectedImagePath, intImagesDir);
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
public String getPath(Uri uri) {
String[] projection = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
public void copy(String scr, File dst) throws IOException {
InputStream in = new FileInputStream(scr);
OutputStream out = new FileOutputStream(dst);
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}
private void deleteLatest() {
// TODO Auto-generated method stub
File f = new File(Environment.getExternalStorageDirectory() + "/DCIM/Camera" );
//Log.i("Log", "file name in delete folder : "+f.toString());
File [] files = f.listFiles();
//Log.i("Log", "List of files is: " +files.toString());
Arrays.sort( files, new Comparator<Object>()
{
public int compare(Object o1, Object o2) {
if (((File)o1).lastModified() > ((File)o2).lastModified()) {
// Log.i("Log", "Going -1");
return -1;
} else if (((File)o1).lastModified() < ((File)o2).lastModified()) {
// Log.i("Log", "Going +1");
return 1;
} else {
// Log.i("Log", "Going 0");
return 0;
}
}
});
//Log.i("Log", "Count of the FILES AFTER DELETING ::"+files[0].length());
files[0].delete();
}
}
What's the gallery log output?
Btw, you're not breaking the rules. This is the right forum for Java Q&A.
nikwen said:
What's the gallery log output?
Click to expand...
Click to collapse
How would I get the Logs for the Gallery? I am using and HTC ONE and it's the standard Gallery. Nothing shows up in LogCat so I'm stuck
nikwen said:
Btw, you're not breaking the rules. This is the right forum for Java Q&A.
Click to expand...
Click to collapse
Great, Thanks!!
StEVO_M said:
How would I get the Logs for the Gallery? I am using and HTC ONE and it's the standard Gallery. Nothing shows up in LogCat so I'm stuck
Great, Thanks!!
Click to expand...
Click to collapse
Do you view the logs on your computer?
There should be an error message in the logs.
nikwen said:
Do you view the logs on your computer?
There should be an error message in the logs.
Click to expand...
Click to collapse
Which Logs?? As I said before. LogCat does not give any errors.

[HOW-TO] Use Code Syntax Highlighting on XDA [Raise Awareness]

XDA is an awesome place for developers to share their knowledge and help each other, no question about it.
However, in my opinion, one of the flaws that prevent the app development forums from being more popular is the
Code:
tags.
Indeed, these tags do not provide syntax highlighting, and when people start pasting their whole Java class, the lack of proper indentation plus the lack of syntax highlighting leaves us with a very off-putting chunk of code, and even if you intend to help in the first place, having to go through this unreadable code can discourage many.
I was ranting about this in the [URL="http://forum.xda-developers.com/showpost.php?p=49938207&postcount=1976"]xda suggestions & feedback thread[/URL], when someone pointed-out the existence of the [B][PHP][/B] tags, which provide syntax highlighting for php, and, the syntaxes of PHP and Java being somewhat similar, they also do the trick for Java.
[FONT="Garamond"][I]Example:[/I][/FONT]
[PHP]
package com.androguide.recovery.emulator;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import android.util.Log;
public class CMDProcessor {
private final String TAG = getClass().getSimpleName();
private static final boolean DEBUG = false;
private Boolean can_su;
public SH sh;
public SH su;
public CMDProcessor() {
sh = new SH("sh");
su = new SH("su");
}
public SH suOrSH() {
return canSU() ? su : sh;
}
public boolean canSU() {
return canSU(false);
}
public class CommandResult {
private final String resultTag = TAG + '.' + getClass().getSimpleName();
public final String stdout;
public final String stderr;
public final Integer exit_value;
CommandResult(final Integer exit_value_in) {
this(exit_value_in, null, null);
}
CommandResult(final Integer exit_value_in, final String stdout_in,
final String stderr_in) {
exit_value = exit_value_in;
stdout = stdout_in;
stderr = stderr_in;
if (DEBUG)
Log.d(TAG, resultTag + "( exit_value=" + exit_value
+ ", stdout=" + stdout + ", stderr=" + stderr + " )");
}
public boolean success() {
return exit_value != null && exit_value == 0;
}
}
public class SH {
private String SHELL = "sh";
public SH(final String SHELL_in) {
SHELL = SHELL_in;
}
private String getStreamLines(final InputStream is) {
String out = null;
StringBuffer buffer = null;
final DataInputStream dis = new DataInputStream(is);
try {
if (dis.available() > 0) {
buffer = new StringBuffer(dis.readLine());
while (dis.available() > 0) {
buffer.append("\n").append(dis.readLine());
}
}
dis.close();
} catch (final Exception ex) {
Log.e(TAG, ex.getMessage());
}
if (buffer != null) {
out = buffer.toString();
}
return out;
}
public Process run(final String s) {
Process process = null;
try {
process = Runtime.getRuntime().exec(SHELL);
final DataOutputStream toProcess = new DataOutputStream(
process.getOutputStream());
toProcess.writeBytes("exec " + s + "\n");
toProcess.flush();
} catch (final Exception e) {
Log.e(TAG,
"Exception while trying to run: '" + s + "' "
+ e.getMessage());
process = null;
}
return process;
}
public CommandResult runWaitFor(final String s) {
if (DEBUG)
Log.d(TAG, "runWaitFor( " + s + " )");
final Process process = run(s);
Integer exit_value = null;
String stdout = null;
String stderr = null;
if (process != null) {
try {
exit_value = process.waitFor();
stdout = getStreamLines(process.getInputStream());
stderr = getStreamLines(process.getErrorStream());
} catch (final InterruptedException e) {
Log.e(TAG, "runWaitFor " + e.toString());
} catch (final NullPointerException e) {
Log.e(TAG, "runWaitFor " + e.toString());
}
}
return new CommandResult(exit_value, stdout, stderr);
}
}
public boolean canSU(final boolean force_check) {
if (can_su == null || force_check) {
final CommandResult r = su.runWaitFor("id");
final StringBuilder out = new StringBuilder();
if (r.stdout != null) {
out.append(r.stdout).append(" ; ");
}
if (r.stderr != null) {
out.append(r.stderr);
}
Log.d(TAG, "canSU() su[" + r.exit_value + "]: " + out);
can_su = r.success();
}
return can_su;
}
}
[/PHP]
Oddly enough, the [B][PHP][/B] tags also work for XML (while the [html] tags, that do exist, don't work):
[PHP]
<LinearLayout
android:id="@+id/contentLayout"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginLeft="8dip"
android:layout_weight="90"
android:orientation="vertical" >
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dip"
android:fontFamily="sans-serif-light"
android:textColor="#33B6EA"
android:textSize="22sp" />
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dip"
android:layout_marginRight="8dip"
android:ellipsize="end"
android:fontFamily="sans-serif-light"
android:textColor="#232323"
android:maxLines="50"
android:textSize="16sp" />
</LinearLayout>
[/PHP]
This doesn't fix the indentation issues, but as you can see, the code is much more readable and welcoming.
By using the [B][PHP][/B] tags instead of the [strike][CODE][/strike] tags, you will be more likely to get answers to your questions involving code.
[B][SIZE="3"][CENTER]So Please, for the sake of the app development forums and the eyes of your readers:
USE THE [COLOR="RoyalBlue"][PHP][/COLOR] TAGS :victory:[/CENTER][/SIZE][/B]
[CENTER][I]Please raise awareness about this, suggest people who don't use the [B][PHP][/B] tags to use them, and together we'll make this app development forum a better place than it already is :good:[/I][/CENTER]
Whoa! Never knew about this. Nice find.
Wow, this is really cool! Thanks for finding. The only problem I have with the PHP tags is on mobile, tapatalk is obviously not supporting it at all:
SimplicityApks said:
Wow, this is really cool! Thanks for finding. The only problem I have with the PHP tags is on mobile, tapatalk is obviously not supporting it at all:
Click to expand...
Click to collapse
Too bad, thanks for reporting :good:
This obviously is just a workaround, xda could quite easily implement a dedicated syntax highlighting plugin for vBulletin as I suggested in the suggestions thread, but for the time being this is probably the closest thing we've got.
Androguide.fr said:
Too bad, thanks for reporting :good:
This obviously is just a workaround, xda could quite easily implement a dedicated syntax highlighting plugin for vBulletin as I suggested in the suggestions thread, but for the time being this is probably the closest thing we've got.
Click to expand...
Click to collapse
They've got it working way better with the CODE tags: Code syntax highlighting announcement!

Create pref and move it to another location

Sorry for the unclear title. What I'm trying to do is the following:
Code:
Button btncheat = (Button) findViewById(R.id.button1);
final EditText score = (EditText) findViewById(R.id.editText1);
btncheat.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String filename = "FlappyBird.xml";
String string = "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n<map>\n<int name=\"score\" value=\"" + score.getText().toString() + "\" />\n</map>";
FileOutputStream outputStream;
try {
outputStream = openFileOutput(filename, Context.MODE_PRIVATE);
outputStream.write(string.getBytes());
outputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
try {
String[] commands = {"mv /data/data/de.aciid.nullgc/files/FlappyBird.xml /data/data/com.dotgears.flappybird/shared_prefs/"};
RunAsRoot(commands);
} catch (Exception e) {
e.printStackTrace();
}
}
});
So, it creates the XML file from the String "string" (I don't know if I can do it like this, but the XML file looks right in the end) and move it to /data/data/com.dotgears.flappybird/shared_prefs/. The creation and moving of the XML file works flawless, but Flappy Bird does not read the pref properly. When I start the game, it says that my highscore is zero, although the score 999 (for example) is in the XML file. As I stated, the XML file looks right, I pasted an original and my modded XML in an online script and there are no differences whatsoever.
So why doesn't this work?

[Q] Same shell command works from console and doesn't work from Activity

//sorry for my english, if any
Hi. I'm using AIDE right on my device (Xperia NeoV, 4.1.B.0.587, root)
And i'm trying to inject key events through the same shell command:
"input keyevent 25" via "su", both in AIDE Console and separated Activity.
//volume-down key is not my target, just good for tests. I've tried different keys, same result.
Part of the code:
Code:
try {
java.lang.Process p = Runtime.getRuntime().exec("su");
DataOutputStream dos = new DataOutputStream(p.getOutputStream());
dos.writeBytes("input keyevent 25\n");
dos.flush();
} catch (IOException ex) {
//log any errors
}
So, when it goes in AIDE ConsoleApp - it pushes down volume.
But when it executes from my Activity - nothing happens (no error messages in log, dos != null);
Maybe there should be some specific permission on manifest?
"android.permission.ACCESS_SUPERUSER" - no changes.
Maybe there should be some trick in code? Or(and?) i'm very stupid. Also, maybe somewhere a whole listing of _simple_ keyInjection project exists?
I managed to solve it already. I'm using this class now:
public void RunAsRoot(String[] cmds){
Process p = null;
try {
p = Runtime.getRuntime().exec("su");
} catch (IOException e) {
e.printStackTrace();
}
DataOutputStream os = new DataOutputStream(p.getOutputStream());
for (String tmpCmd : cmds) {
try {
os.writeBytes(tmpCmd+"\n");
} catch (IOException e) {
e.printStackTrace();
}
}
try {
os.writeBytes("exit\n");
} catch (IOException e) {
e.printStackTrace();
}
try {
os.flush();
} catch (IOException e) {
e.printStackTrace();
}
Click to expand...
Click to collapse
Then simply call it via
String[] commands = {"command1", "command2", "command3", ...};
RunAsRoot(commands);
Click to expand...
Click to collapse
Thanks anyways!
Click to expand...
Click to collapse
Credits: @KrauseDroid
Our original thread i took it from:
http://forum.xda-developers.com/showthread.php?t=2725173
---------------------------------
Phone : Nexus 4
OS:
Pure KitKat 4.4.2 stock, no root, no mods
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
Masrepus said:
Credits: @KrauseDroid
Our original thread i took it from:
http://forum.xda-developers.com/showthread.php?t=2725173
Click to expand...
Click to collapse
I saw that thread before creating own, and tried solutions from it. They works same way - only from ConsoleApp in AIDE.
Also, last method is the same as I'm already using, but I've tried to copy code in project - no progress.
In addition:
- superuser rights granted to both.
- test "ls" command put into dos object gives me same list of current dir in both projects, so commands seems to run.
Listing:
MainActivity:
Code:
package com.tsk.mk;
import android.app.*;
import android.content.*;
import android.os.*;
import android.widget.*;
import java.io.*;
public class MainActivity extends Activity {
public static TextView logView;
[user=439709]@override[/user]
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
logView = (TextView) findViewById(R.id.log);
log("creating sercice");
final MainActivity me = this;
new Thread() {
[user=439709]@override[/user]
public void run() {
log("thread.run");
startService(new Intent(me, MissedKeysService.class));
log("thread: service shoul'd be created");
}
}.start();
log("end of MA.onCreate method");
}
static void log(String message) {
logView.setText(logView.getText() + "\n" + message);
}
}
MissedKeysService:
Code:
package com.tsk.mk;
import android.app.*;
import android.content.*;
import android.graphics.*;
import android.os.*;
import android.view.*;
import java.io.*;
public class MissedKeysService extends Service {
private WindowManager windowManager;
private MissedKeysView mkv;
private WindowManager.LayoutParams params;
private DataOutputStream dos;
[user=439709]@override[/user]
public IBinder onBind(Intent intent) {
MainActivity.log("onBind called o_o");
return null;
}
[user=439709]@override[/user]
public void onCreate() {
MainActivity.log("Service.onCreate");
super.onCreate();
try {
java.lang.Process p = Runtime.getRuntime().exec("su");
dos = new DataOutputStream(p.getOutputStream());
} catch (IOException ex) {
MainActivity.log(ex.getMessage());
dos = null;
}
windowManager = (WindowManager)
getSystemService(WINDOW_SERVICE);
mkv = new MissedKeysView(this, this);
params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
params.gravity = Gravity.RIGHT | Gravity.CENTER_VERTICAL;
params.width = MissedKeysView.keySize;
params.height = MissedKeysView.keySize;
windowManager.addView(mkv, params);
MainActivity.log("Service started");
}
[user=439709]@override[/user]
public void onDestroy () {
super.onDestroy ();
if (mkv != null) windowManager.removeView(mkv);
MainActivity.log("Ssrvice is ended");
}
public void extend(boolean state) {
params.height = mkv.keySize * (state ? MissedKeysView.keys : 1);
windowManager.updateViewLayout(mkv, params);
}
public void sendKey(int code) {
if (dos == null) MainActivity.log("dos is null");
try {
dos.writeBytes("input keyevent " + code + "\n");
dos.flush();
MainActivity.log("" + code);
} catch (IOException e) {
MainActivity.log("wtf?");
}
}
}
MissedKeysView:
Code:
package com.tsk.mk;
import android.content.*;
import android.graphics.*;
import android.view.*;
import android.view.View.*;
import java.io.*;
public class MissedKeysView extends View
implements OnTouchListener {
final static int keySize = 64;
final static String[] labels = {":", "+", "-", "^", "v", "o", "<", ">"};
final private int[] codes = {-1, 24, 25, 19, 20, 23, 21, 22};
final static int keys = 3; //max shown keys
MissedKeysService mks;
Paint bgP; //background
Paint hbgP; //highlighted bg
Paint tP; //text
int selected = -1; //active key
public MissedKeysView(Context context, MissedKeysService mks) {
super(context);
this.mks = mks;
bgP = new Paint();
bgP.setARGB(64, 128, 128, 128);
hbgP = new Paint();
hbgP.setARGB(64, 255, 128, 0);
tP = new Paint();
tP.setARGB(128, 255, 255, 255);
tP.setTextSize(keySize);
tP.setTextAlign(Paint.Align.CENTER);
setOnTouchListener(this);
}
[user=439709]@override[/user]
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
for(int i=0; i<getHeight()/keySize; i++) {
canvas.drawCircle(keySize/2,
keySize/2 + i*keySize, keySize/2,
(i == selected ? hbgP : bgP));
canvas.drawText(labels[i], keySize/2, i*keySize + keySize*3/4, tP);
}
}
[user=439709]@override[/user]
public boolean onTouch(View v, MotionEvent event) {
switch(event.getAction()) {
case MotionEvent.ACTION_DOWN:
selected = (int) (event.getY()/keySize);
if (selected == 0) mks.extend((int) getHeight() <= keySize);
else mks.sendKey(codes[selected]);
break;
case MotionEvent.ACTION_UP:
selected =-1;
}
invalidate();
return super.onTouchEvent(event);
}
}
AndroidManifest:
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tsk.mk"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="11" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".MainActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".MissedKeysService"
android:exported="true" >
</service>
</application>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
<uses-permission android:name="android.permission.INJECT_EVENTS" />
</manifest>
@Torsionick do you have the permission INJECT_EVENTS
---------------------------------
Phone : Nexus 4
OS:
Pure KitKat 4.4.2 stock, no root, no mods
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
Masrepus said:
@Torsionick do you have the permission INJECT_EVENTS
Click to expand...
Click to collapse
Thanks for participating in solving.
The reason was somewhere else - after executing "export LD_LIBRARY_PATH=/system/lib" all works fine. Thread is over.

Categories

Resources