here is the original htc apk. I was able to uncompress it, extract the class file and open it in a jave environment, what i need help is i found where it shows the following
public class FlashRestriction
{
private static final byte BATTERY_CAPACITY_FLAG = 1;
private static int BATTERY_CAPACITY_LIMIT = 0;
private static final String BATTERY_CAPACITY_LIMIT_PATH = "/sys/camera_led_status/low_cap_limit";
private static final String BATTERY_CAPACITY_PATH = "/sys/class/power_supply/battery/capacity";
private static final byte BATTERY_TEMPERATURE_FLAG = 2;
private static int BATTERY_TEMPERATURE_LIMIT = 0;
private static final String BATTERY_TEMPERATURE_LIMIT_PATH = "/sys/camera_led_status/low_temp_limit";
private static final String BATTERY_TEMPERATURE_PATH = "/sys/class/power_supply/battery/batt_temp";
private static final byte HOTSPOT_STATUS_FLAG = 16;
private static final String HOTSPOT_STATUS_PATH = "/sys/camera_led_status/led_hotspot_status";
private static final byte NO_LIMIT_FLAG = 0;
private static final byte RIL_STATUS_FLAG = 8;
private static final String RIL_STATUS_PATH = "/sys/camera_led_status/led_ril_status";
private static final String TAG = "FlashRestriction";
private static final byte WIMAX_STATUS_FLAG = 4;
private static final String WIMAX_STATUS_PATH = "/sys/camera_led_status/led_wimax_status";
private byte mDisableFlash = 0;
private FileObserver mFileObserver_BatCap = null;
private FileObserver mFileObserver_BatTemp = null;
private FileObserver mFileObserver_HotSpot = null;
private FileObserver mFileObserver_RIL = null;
private FileObserver mFileObserver_Wimax = null;
private byte mIsLimitBatCap = 0;
private byte mIsLimitBatTemp = 0;
private byte mIsLimitHotSpot = 0;
private byte mIsLimitRIL = 0;
private byte mIsLimitWimax = 0;
private Handler mUIHandler = null;
static
{
BATTERY_CAPACITY_LIMIT = 15;
initBatteryLimit();
In the flashrestriction section but i cant get it to edit down to 5%
Is there anyone who can edit this apk so it will allow the camera flash to be used down to 5% and then resign it so we can install it over the current one or make a patch for the current installed version?
Thank you in advance.
Related
I have a C# dll that makes use of sms.dll and cemapi.dll to send sms from pda...
I want to use the dll in a java application (which is in a j2me standard) using jni...I m new to the concept...
I dont know how to call a smart device Windows Mobile C# dll from java using jni,through i have seen samples for calling simple 'helloworld' dlls from java..
I wud like somebody who has done this before to help me in writing the wrapper
classes to call the dll..
Please also suggest the method to test the dll in pda.
The C# code is given below:
public class Util
{
private static bool SendMessage_WM2k3(string destination, string message)
{
// SEND = 2, RECEIVE = 1
IntPtr handle;
IntPtr intPtr = IntPtr.Zero;
if (SmsOpen("Microsoft Text SMS Protocol", 2, out handle, ref intPtr) == 0)
{
byte[] array = new byte[0x204];
if (destination.StartsWith("+"))
{
BitConverter.GetBytes(1).CopyTo(array, 0);
}
Encoding.Unicode.GetBytes(destination).CopyTo(array, 4);
int dwProviderSpecificDataSize = 0xa4;
byte[] buffer2 = new byte[dwProviderSpecificDataSize];
BitConverter.GetBytes(1).CopyTo(buffer2, 4); // messageclass = 1
int messageId;
if (SmsSendMessage(handle, null, array, null, message, message.Length * 2, buffer2, dwProviderSpecificDataSize, 0, 0, out messageId) == 0)
{
SmsClose(handle);
return true;
}
}
return false;
}
private static Thread m_SendSMSThread;
private static string m_sRecipientPhone;
private static string m_sSMSContent;
private void SendSMS()
{
bool bSuccess;
if (Environment.OSVersion.Version.Major < 5) // WM 2k3 and previous
{
bSuccess = SendMessage_WM2k3(m_sRecipientPhone, m_sSMSContent);
}
else
{
bSuccess = SendSMSMessage(m_sRecipientPhone, m_sSMSContent, false) == 0;
}
if (bSuccess)
{
MessageBox.Show("SMS message was sent successfully!", "SMS",
MessageBoxButtons.OK, MessageBoxIcon.None, MessageBoxDefaultButton.Button1);
}
else
{
MessageBox.Show("Error when sending SMS message", "Error",
MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
}
}
public static void SendSMS(string recipient, string sContent)
{
m_sRecipientPhone = recipient;
m_sSMSContent = sContent;
m_SendSMSThread = new Thread(SendSMS);
m_SendSMSThread.Start();
}
[DllImport("cemapi.dll", EntryPoint = "#48", SetLastError = true)]
private static extern int SendSMSMessage(string RecipientAddress, string MessageText, bool DeliveryReportRequested);
[DllImport("sms.dll")]
private static extern int SmsSendMessage(IntPtr smshHandle, byte[] psmsaSMSCAddress, byte[] psmsaDestinationAddress, byte[] pstValidityPeriod, string pbData, int dwDataSize, byte[] pbProviderSpecificData, int dwProviderSpecificDataSize, int smsdeDataEncoding, int dwOptions, out int psmsmidMessageID);
[DllImport("sms.dll")]
private static extern int SmsOpen(string ptsMessageProtocol, int dwMessageModes, out IntPtr psmshHandle, ref IntPtr phMessageAvailableEvent);
[DllImport("sms.dll")]
private static extern int SmsClose(IntPtr smshHandle);
}
Please reply as early as possible.
Thanks in advance.
Sorry, I am quite new to android development, but I was wondering why
public boolean onTouch(View arg0, MotionEvent arg1) {
TextView t1 = (TextView) findViewById(R.id.textView2);
TextView t2 = (TextView) findViewById(R.id.textView3);
t1.setText("X: "+arg1.getX());
t2.setText("Y: "+arg1.getY());
int x = (int)arg1.getX();
int y = (int)arg1.getY();
int width = 300;
int height = 300;
ShapeDrawable mDrawable = new ShapeDrawable(new OvalShape());
mDrawable.getPaint().setColor(0xff74AC23);
mDrawable.setBounds(x, y, x+width, y+height);
ImageView v = (ImageView) findViewById(R.id.imageView1);
v.setImageDrawable(mDrawable);
Will not draw a dot where the user clicks in the imageview
No ideas anybody?
I am building a mileage tracking app for my personal use at work and am to populate a SQLite table with information about the trips I make. I have 2 spinners that allow me to select my starting and ending locations for a trip. I have a button that says, "Log Trip" and when I click on it, it should do an insert into the table with the information about my trip. Everything is working except for one of the spinners. No matter what I pick for my starting location in my app. The table populates the ending location in both starting and ending columns. For example, if I pick a trip going from locationA to locationB in my database the starting column will say locationB and the ending column will also say locationB.
Here is the code I have. Please help, thanks. ps. Very new to this so sorry if the code is crappy.
Code:
//When the Log Trip button is pressed, settings are saved to DB
final Button logTripBtn = (Button) findViewById(R.id.logTripBTN);
logTripBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
DatePicker pickdate = (DatePicker) findViewById(R.id.datePicker1);
final int monthPicked = pickdate.getMonth();
final int dayPicked = pickdate.getDayOfMonth();
TimePicker pickTime = (TimePicker) findViewById(R.id.timePicker1);
final int hourPicked = pickTime.getCurrentHour();
final int minutePicked = pickTime.getCurrentMinute();
final EditText startingMileage = (EditText) findViewById(R.id.beginningMileageET);
final String startMiles = startingMileage.getText().toString();
final EditText endingMileage = (EditText) findViewById(R.id.endingMileageET);
final String endMiles = (String) endingMileage.getText().toString();
EditText tripComments = (EditText) findViewById(R.id.commentsET);
final String comment = (String) tripComments.getText().toString();
//Gets and stores the selected spinner values
Spinner originLocationSpinner = (Spinner) findViewById(R.id.originSpinner);
Spinner destinationLocationSpinner = (Spinner) findViewById(R.id.destinationSpinner);
final String originSpinnerSelected;
final String destinationSpinnerSelected;
Cursor c1 = (Cursor)(originLocationSpinner.getSelectedItem());
Cursor c2 = (Cursor)(destinationLocationSpinner.getSelectedItem());
if ((c1 != null) && (c2 != null)) {
originSpinnerSelected = c1.getString(c1.getColumnIndex(mDbHelper.LOCATIONS_COLUMN1));
destinationSpinnerSelected = c2.getString(c2.getColumnIndex(mDbHelper.LOCATIONS_COLUMN1));
//Calls method in mileagDbAdapter.java that inserts the trip information into the database
mDbHelper.logTripInfo(originSpinnerSelected, destinationSpinnerSelected, startMiles, endMiles, monthPicked, dayPicked, hourPicked, minutePicked, comment);
}}
});
Hi All,
I am a not experienced developer. All I want to do is make a small app to track information of football on TV. I want to do it through a small DB however I've been struggling a lot with an error I've been trying to discover in the last two weeks but I have not been able.
I have teh following code in the class I create the DB
public class DBAdapter {
public static final String KEY_ROWID = "_id";
public static final String KEY_GDATE = "gdate";
public static final String KEY_GTIME = "gtime";
public static final String KEY_GGAME = "ggame";
public static final String KEY_GCOMPETITION = "gcompetition";
public static final String KEY_GCHANNEL = "gchannel";
private static final String TAG = "DBAdapter";
private static final String DATABASE_NAME = "FonTV";
private static final String DATABASE_TABLE = "games";
private static final int DATABASE_VERSION = 2;
private static final String DATABASE_CREATE =
"create table games (_id integer primary key autoincrement, "
+ "gdate text not null, gtime text not null, ggame text not null" +
"gcompetition text not null, gchannel text not null);";
private final Context context;
private DatabaseHelper DBHelper;
private SQLiteDatabase db;
public DBAdapter(Context ctx)
{
this.context = ctx;
DBHelper = new DatabaseHelper(context);
}
private static class DatabaseHelper extends SQLiteOpenHelper
{
DatabaseHelper(Context context)
{
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db)
{
try {
db.execSQL(DATABASE_CREATE);
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
+ newVersion + ", which will destroy all old data");
db.execSQL("DROP TABLE IF EXISTS contacts");
onCreate(db);
}
}
//---opens the database---
public DBAdapter open() throws SQLException
{
db = DBHelper.getWritableDatabase();
return this;
}
//---closes the database---
public void close()
{
DBHelper.close();
}
//---insert a contact into the database---
public long insertContact(String gdate, String gtime, String ggame, String gcompetition, String gchannel )
{
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_GDATE, gdate);
initialValues.put(KEY_GTIME, gtime);
initialValues.put(KEY_GGAME, ggame);
initialValues.put(KEY_GCOMPETITION, gcompetition);
initialValues.put(KEY_GCHANNEL, gchannel);
return db.insert(DATABASE_TABLE, null, initialValues);
}
}
And the main class where I try to insert data has this:
public class ResultsDBActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
DBAdapter db = new DBAdapter(this);
db.open();
long id = db.insertContact("12/may", "08:00", "Leeds vs York", "JUME Cup", "ITV, BBC");
id = db.insertContact("13/may", "09:00", "London vs Bath", "JUME Cup", "ITV, BBC2");
db.close();
}
}
However when I try to run it, the debugger shows and error that says:
E/Database(330): android.database.sqlite.SQLiteException: no such table: games: , while compiling: INSERT INTO games(gchannel, ggame, gtime, gdate, gcompetition) VALUES(?, ?, ?, ?, ?);
I’ve trying to change parameters and many things but I haven’t found where the problem is. Can someone help me please?
I have 4 checboxes that i want to enter in the SQLite table. I want that the values of the checkboxes must only be saved if the checkbox's are ticked. This is the code that i have used. The checkboxes are getting saved to the database but all of them are getting saved, even the checbox's i didnt check. Please help me with the code
Code:
private void SaveContent() {
EditText IdInput = (EditText) findViewById(R.id.StationID);
EditText NameInput = (EditText) findViewById(R.id.StationName);
EditText EmailInput = (EditText) findViewById(R.id.Email);
EditText LocationInput = (EditText) findViewById(R.id.Location);
final CheckBox wifi = (CheckBox) findViewById(R.id.Wifi);
if (wifi.isChecked()) {
final String strWifi = wifi.getText().toString();
}
final CheckBox toilets = (CheckBox) findViewById(R.id.Toilets);
if (toilets.isChecked()) {
final String strToilets = wifi.getText().toString();
}
final CheckBox lifts = (CheckBox) findViewById(R.id.Lifts);
if (lifts.isChecked()) {
final String strLifts = lifts.getText().toString();
}
final CheckBox ramps = (CheckBox) findViewById(R.id.Ramps);
if (ramps.isChecked()) {
final String strRamps =ramps.getText().toString();
}
final String strWifi = wifi.getText().toString();
final String strToilets = toilets.getText().toString();
final String strRamps = ramps.getText().toString();
final String strLifts = lifts.getText().toString();
final String strStationID = IdInput.getText().toString();
final String strName = NameInput.getText().toString();
final String strEmail = EmailInput.getText().toString();
final String strLocation = LocationInput.getText().toString();
final String strStationType = StationType[position];
new AlertDialog.Builder(this)
.setTitle("Details entered")
.setMessage(
" Details entered:\n" + strStationID + "\n" + strName + "\n " + strStationType +
"\n" + strWifi + "\n" + strToilets + "\n" + strLifts + "\n" + strRamps + "\n" +
strLocation + "\n" + strEmail )
.setNeutralButton("Back",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
})
.setPositiveButton("Save",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
saveStation(strStationID, strName, strStationType, strWifi,strToilets, strLifts, strRamps, strLocation, strEmail);
}
}).show();
}
public void saveStation(String StationID, String StationName, String StationType, String Wifi, String Toilets,
String Lifts, String Ramps, String Location, String Email) {
try {
dbHelper.insertStation(StationID,StationName,StationType,Wifi,Toilets,Lifts,Ramps,Location,Email);
new AlertDialog.Builder(AddStation.this)
.setTitle("\nStation Saved Successfully\n")
.setNeutralButton("View",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
viewStatiton();
}
}).show();
} catch (SQLiteException sqle) {
android.util.Log.w(this.getClass().getName(),
" Error saving to database");
new AlertDialog.Builder(AddStation.this)
.setTitle("Couldn't save details")
.setNeutralButton("Next",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
// do nothing
}
}).show();
}
}
Code:
public class SQL extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "FacilitiesReview";
static final String TABLE_NAME="Stations";
static final String COL_StationID="StationID";
static final String COL_StationNAME="StationName";
static final String COL_StationType="StationType";
static final String COL_Wifi="Wifi";
static final String COL_Toilets="Toilets";
static final String COL_Lifts="Lifts";
static final String COL_Ramps="Ramps";
static final String COL_Email="Email";
static final String COL_Location="Location";
private SQLiteDatabase database;
public SQL(Context context) {
super(context, DATABASE_NAME, null, 1);
database = getWritableDatabase();
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE StationTable (StationID INTEGER PRIMARY KEY, StationName TEXT, " +
"StationType TEXT, Wifi TEXT, Toilets TEXT, Lifts TEXT, Ramps Text, Location TEXT, Email TEXT );");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
android.util.Log.w(this.getClass().getName(),
DATABASE_NAME + " database upgrade to version " + newVersion + " old data lost");
db.execSQL("DROP TABLE IF EXISTS details");
onCreate(db);
}
public long insertStation(String StationID, String StationName, String StationType, String Wifi, String Toilets,
String Lifts, String Ramps, String Location, String Email) {
ContentValues rowValues = new ContentValues();
rowValues.put("StationID", StationID);
rowValues.put("StationName", StationName);
rowValues.put("StationType", StationType);
rowValues.put("Wifi", Wifi);
rowValues.put("Toilets", Toilets);
rowValues.put("Lifts", Lifts);
rowValues.put("Ramps", Ramps);
rowValues.put("Location", Location);
rowValues.put("Email", Email);
return database.insertOrThrow("Station", null, rowValues);
}
public long getNumberOfRecords() {
Cursor c = database.query("Station",null,null, null, null, null, null);
return c.getCount();
}
public Cursor getAllRecords() {
return database.query(TABLE_NAME, null, null, null, null, null,
COL_StationNAME);
}
public void deleteAllRecords() {
database.delete(TABLE_NAME, null, null);
}
}
Hi there,
I'm sorry but I can't find anything related to your question.
Please post that in the forum bellow for more answers from the experts:
> Android Development and Hacking > Android Q&A, Help & Troubleshooting
Also you can read about that here: IDEs, Libraries, & Programming Tools or App Development Forums
Good luck