Skip to main content

Posts

Showing posts from March 5, 2012

How do I change the Android SMS tone despite of current SMS tone setting?

I have developed an Android application for changing ringtones. It works quite well, but one thing bothers me. When I set a ringtone as a notification tone, it plays when I receive an SMS message. However, if I have chosen a custom SMS tone earlier (ie. anything else than "Default ringtone" which is active by default) in the SMS settings, the new notification tone will not play when I receive an SMS. This might lead to a situation in which someone installs the ringtone app from the Android market, sets the notification tone and gets disappointed because the chosen notification will not play when (s)he receives an SMS. The solution is quite easy (SMS -> Settings -> Select ringtone -> Default ringtone), but it's truly a nuisance if (s)he doesn't know this. This is what I use to set the notification tone: values.put(MediaStore.Audio.Media.IS_RINGTONE, true); values.put(MediaStore.Audio.Media.IS_NOTIFICATION, true); values.put(MediaStore.Audio.Media.IS_AL

How do I change the Android SMS tone despite of current SMS tone setting?

I have developed an Android application for changing ringtones. It works quite well, but one thing bothers me. When I set a ringtone as a notification tone, it plays when I receive an SMS message. However, if I have chosen a custom SMS tone earlier (ie. anything else than "Default ringtone" which is active by default) in the SMS settings, the new notification tone will not play when I receive an SMS. This might lead to a situation in which someone installs the ringtone app from the Android market, sets the notification tone and gets disappointed because the chosen notification will not play when (s)he receives an SMS. The solution is quite easy (SMS -> Settings -> Select ringtone -> Default ringtone), but it's truly a nuisance if (s)he doesn't know this. This is what I use to set the notification tone: values.put(MediaStore.Audio.Media.IS_RINGTONE, true); values.put(MediaStore.Audio.Media.IS_NOTIFICATION, true); values.put(MediaStore.Audio.Media.IS_AL

App Bypassing the Login-screen, even though it shouldn"t

Whenever I launch my App, even from a new emulator with now files created it still executes the bit of code, that says if the file has been created do this intent, I don't understand, it shouldn't, I have no way of testing, because I have an iPhone not an Android phone, in theory the code should not be called, only on the second time loading the app. Thanks! Code: Public class LogIn extends Activity implements OnClickListener { Button send; EditText user; EditText pass; CheckBox staySignedIn; FileOutputStream Fos; String a; String b; String string = a; String string2 = b; String DANNYISREALLLLYYYGAAYYYYYIMNOTBS; String FILENAME = "userandpass"; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.login); send = (Button) findViewById(R.id.bLogIn); user = (EditText) find

Fetching a large number of contacts

I'm trying to fetch all the Phone numbers and Emails in Android.by using this code. enter code here String KEY_NAME = "Name"; String KEY_NO = "No"; String selection = ContactsContract.CommonDataKinds.Phone.IN_VISIBLE_GROUP + " = 1"; String sortOrder = ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; String data=""; String name=""; ContactEntry contactObj; String id; List<String> temp = new ArrayList<String>(); final String[] projection = new String[]{ContactsContract.Contacts._ID , ContactsContract.Contacts.DISPLAY_NAME , ContactsContract.Contacts.HAS_PHONE_NUMBER}; final String[] email_projection = new String[] {ContactsContract.CommonDataKinds.Email.DATA , ContactsContract.CommonDataKinds.Email.TYPE}; final String[] phone_projection = new String[] {ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.

Fetching a large number of contacts

I'm trying to fetch all the Phone numbers and Emails in Android.by using this code. enter code here String KEY_NAME = "Name"; String KEY_NO = "No"; String selection = ContactsContract.CommonDataKinds.Phone.IN_VISIBLE_GROUP + " = 1"; String sortOrder = ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " COLLATE LOCALIZED ASC"; String data=""; String name=""; ContactEntry contactObj; String id; List<String> temp = new ArrayList<String>(); final String[] projection = new String[]{ContactsContract.Contacts._ID , ContactsContract.Contacts.DISPLAY_NAME , ContactsContract.Contacts.HAS_PHONE_NUMBER}; final String[] email_projection = new String[] {ContactsContract.CommonDataKinds.Email.DATA , ContactsContract.CommonDataKinds.Email.TYPE}; final String[] phone_projection = new String[] {ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.

SQLlite Android. Managing data

Hi friends. I'll tell you the aim of this part of my app. I've got a SQLite dB which has 3 columns. First is "Quantity", Second is "Product" and third is "Price". Well, what i want to do is to get the whole dB and send it by email. This is what i have right now: public class Visual extends Activity { TextView tv; Button sqlGetInfo; long l ; long b=1; int c,i; String returnedQuantity ,returnedProduct ,returnedPrice; String[] filas; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.visual); tv = (TextView) findViewById(R.id.tvSQLinfo); sqlGetInfo = (Button) findViewById(R.id.EnviarPedido); SQLManager info = new SQLManager(this); info.open(); String data= info.getData(); info.close(); tv.setText(data); Up to here, my code works fine, it displays the data in the textView. Here is the problem. My dB has

SQLlite Android. Managing data

Hi friends. I'll tell you the aim of this part of my app. I've got a SQLite dB which has 3 columns. First is "Quantity", Second is "Product" and third is "Price". Well, what i want to do is to get the whole dB and send it by email. This is what i have right now: public class Visual extends Activity { TextView tv; Button sqlGetInfo; long l ; long b=1; int c,i; String returnedQuantity ,returnedProduct ,returnedPrice; String[] filas; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.visual); tv = (TextView) findViewById(R.id.tvSQLinfo); sqlGetInfo = (Button) findViewById(R.id.EnviarPedido); SQLManager info = new SQLManager(this); info.open(); String data= info.getData(); info.close(); tv.setText(data); Up to here, my code works fine, it displays the data in the textView. Here is the problem. My dB has

Send data from android to mysql using php

I have a some text on an android client, I want to send it to the database(MySQL). How do I do this.Please help me with this. I tried using php and Mysql. Is the query in Php right?? Here is what I have tried Insert.java public class Insert extends ListActivity { String[] ct_name = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.main); InputStream is = null; // http post ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("c_name","KL")); try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://10.0.2.2/city1.php"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = enti

Send data from android to mysql using php

I have a some text on an android client, I want to send it to the database(MySQL). How do I do this.Please help me with this. I tried using php and Mysql. Is the query in Php right?? Here is what I have tried Insert.java public class Insert extends ListActivity { String[] ct_name = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.main); InputStream is = null; // http post ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("c_name","KL")); try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://10.0.2.2/city1.php"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = enti

android device to backup data on local server

I am working on the android application that would perform functionality and ultimately save the data(Highly Confidential) in a local server, I am a newbie, I need ideas from you people in the shape of steps that i need to follow for the implementation. I cant expose the main main idea but the thing is store the customer data (in the database placed on server) on the server via android tablets, there will be multiple tablets feeding the data in parallel. I will appreciate if someone would suggest the appropriate tutorials (for webservice creation/usage etc)

android device to backup data on local server

I am working on the android application that would perform functionality and ultimately save the data(Highly Confidential) in a local server, I am a newbie, I need ideas from you people in the shape of steps that i need to follow for the implementation. I cant expose the main main idea but the thing is store the customer data (in the database placed on server) on the server via android tablets, there will be multiple tablets feeding the data in parallel. I will appreciate if someone would suggest the appropriate tutorials (for webservice creation/usage etc)

simple Voip client for the android

Now I am working to create a simple Voip client for the android based on the pjsip stack. Only require simple features. Make call, Hang up, Speaker phone on/off, Detect Hang up. To be functional over any internet connection.Can you please tell me the feasibility and provide some sample references?

simple Voip client for the android

Now I am working to create a simple Voip client for the android based on the pjsip stack. Only require simple features. Make call, Hang up, Speaker phone on/off, Detect Hang up. To be functional over any internet connection.Can you please tell me the feasibility and provide some sample references?

Json-RPC Method from iOS to Android

I have a java webservice, with some method. The webservice methods are in this form: @Webservice(paramNames = {"email", "password", "stayLogged", "idClient"}, public Response startSession(String email, String password, Boolean stayLogged, String idClient) throws Exception { boolean rC = stayLogged != null && stayLogged.booleanValue(); UserService us = new UserService(); User u = us.getUsersernamePassword(email, password); if (u == null || u.getActive() != null && !u.getActive().booleanValue()) { return ErrorResponse.getAccessDenied(id, logger); } InfoSession is = null; String newKey = null; while (newKey == null) { newKey = UserService.md5(Math.random() + " " + new Date().getTime()); if (SessionManager.get(newKey) != null) { newKey = null; } else { is = new InfoSession(u, rC, newKey); if (idClient != null && id

Json-RPC Method from iOS to Android

I have a java webservice, with some method. The webservice methods are in this form: @Webservice(paramNames = {"email", "password", "stayLogged", "idClient"}, public Response startSession(String email, String password, Boolean stayLogged, String idClient) throws Exception { boolean rC = stayLogged != null && stayLogged.booleanValue(); UserService us = new UserService(); User u = us.getUsersernamePassword(email, password); if (u == null || u.getActive() != null && !u.getActive().booleanValue()) { return ErrorResponse.getAccessDenied(id, logger); } InfoSession is = null; String newKey = null; while (newKey == null) { newKey = UserService.md5(Math.random() + " " + new Date().getTime()); if (SessionManager.get(newKey) != null) { newKey = null; } else { is = new InfoSession(u, rC, newKey); if (idClient != null && id

when i invoke gmail to send some advice the bluetooth come out, too

this is my code to invoke gmail. private void sendMail() { // Device model String PhoneModel = android.os.Build.MODEL; // Android version String AndroidVersion = android.os.Build.VERSION.RELEASE; final Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "****@gmail.com"}); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "'some feedbace..."); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "—— phoneModel:" + PhoneModel + ";ROM:" + AndroidVersion); startActivity(Intent.createChooser(emailIntent, "Sending mail...")); } when i click the menu to invoke the gmail to send feedback,the bluetooth come out too,with the gmail,and waiting for me to select one.but i just want to invoke the gmail app.what

List all the folder and files of Dropbox using Dropbox API

Am looking for the tutorial to display all the files and folder in a listview..but I didn't get anything..Does anyone here know that how can I show all the folder and files of Dropbox into my listview..So that when I click on any of the file..Then that file starts download.. Well I know here that How to download a file from Dropbox, but for that I need to put that name of the file in my code in a static way.. I am also going to use filter afterwards for .csv file only...but I want to show all the files in a listview. Thanks..

when i invoke gmail to send some advice the bluetooth come out, too

this is my code to invoke gmail. private void sendMail() { // Device model String PhoneModel = android.os.Build.MODEL; // Android version String AndroidVersion = android.os.Build.VERSION.RELEASE; final Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "****@gmail.com"}); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "'some feedbace..."); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "—— phoneModel:" + PhoneModel + ";ROM:" + AndroidVersion); startActivity(Intent.createChooser(emailIntent, "Sending mail...")); } when i click the menu to invoke the gmail to send feedback,the bluetooth come out too,with the gmail,and waiting for me to select one.but i just want to invoke the gmail app.what

List all the folder and files of Dropbox using Dropbox API

Am looking for the tutorial to display all the files and folder in a listview..but I didn't get anything..Does anyone here know that how can I show all the folder and files of Dropbox into my listview..So that when I click on any of the file..Then that file starts download.. Well I know here that How to download a file from Dropbox, but for that I need to put that name of the file in my code in a static way.. I am also going to use filter afterwards for .csv file only...but I want to show all the files in a listview. Thanks..

In ImageSwicher/ViewFlipper ImageView is blurry when i set zoom Animation?

In my App i am showing slideshow of images preloaded on Drawable. In Slideshow i used all ImageSwicher/ViewFlipper/ViewSwicher. In slideshow every image have it's own animation like zoom and scale. I get blurry image when animation is on progress....... Please help me as soon as possible. Note- Image quality is good. Animation zoomimage = AnimationUtils.loadAnimation(getContext(), R.anim.zoomscale); zoomimage.setRepeatCount(0); _imageSwitcher.startAnimation(zoomimage);

In ImageSwicher/ViewFlipper ImageView is blurry when i set zoom Animation?

In my App i am showing slideshow of images preloaded on Drawable. In Slideshow i used all ImageSwicher/ViewFlipper/ViewSwicher. In slideshow every image have it's own animation like zoom and scale. I get blurry image when animation is on progress....... Please help me as soon as possible. Note- Image quality is good. Animation zoomimage = AnimationUtils.loadAnimation(getContext(), R.anim.zoomscale); zoomimage.setRepeatCount(0); _imageSwitcher.startAnimation(zoomimage);

App Bypassing the Login-screen, even though it shouldn"t

Whenever I launch my App, even from a new emulator with now files created it still executes the bit of code, that says if the file has been created do this intent, I don't understand, it shouldn't, I have no way of testing, because I have an iPhone not an Android phone, in theory the code should not be called, only on the second time loading the app. Thanks! Code: Public class LogIn extends Activity implements OnClickListener { Button send; EditText user; EditText pass; CheckBox staySignedIn; FileOutputStream Fos; String a; String b; String string = a; String string2 = b; String DANNYISREALLLLYYYGAAYYYYYIMNOTBS; String FILENAME = "userandpass"; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.login); send = (Button) findViewById(R.id.bLogIn); user = (EditText) find

Who can I create a Share Android App to send to my clients or colleagues? Like iOS AdHoc

I'm over an Android App for a client, eventually I want to show him some demo, but he doesn't have the IDE, so I'm thinking to send him an APK ... In iOS it's pretty easy through AdHoc and the Mobile ID... I just want to send him an APK for him to install in his phone... (Not Android Market YET) How can I do this on Android? Thanks!

How should a SQLiteDatabase connection be handled inside an AsyncTaskLoader?

I wondering where and when I should open/close my SQLiteDatabase connection in my AsyncTaskLoader. I don't feel like i fully understand the lifecycle of a Loader, so I'm afraid that I might run into some memory leaks/NullPointerExceptions if I don't to this right. I currently open up my SQLiteDatabase in the constructor of my loader: private class SQLiteCursorLoader extends AsyncTaskLoader<Cursor> { private String _queryString; private SQLiteDatabase _db; ... public SQLiteCursorLoader(Context context, String queryString) { super(context); _queryString = queryString; _db = MySQLiteOpenHelper.getWritableDatabase(); } .... } But where do I close the connection again?

How should a SQLiteDatabase connection be handled inside an AsyncTaskLoader?

I wondering where and when I should open/close my SQLiteDatabase connection in my AsyncTaskLoader. I don't feel like i fully understand the lifecycle of a Loader, so I'm afraid that I might run into some memory leaks/NullPointerExceptions if I don't to this right. I currently open up my SQLiteDatabase in the constructor of my loader: private class SQLiteCursorLoader extends AsyncTaskLoader<Cursor> { private String _queryString; private SQLiteDatabase _db; ... public SQLiteCursorLoader(Context context, String queryString) { super(context); _queryString = queryString; _db = MySQLiteOpenHelper.getWritableDatabase(); } .... } But where do I close the connection again?

Getting the Selected View from ListView

I am using a CursorAdapter to handle my ListActivity: public class Mclass extends ListActivity{ ... TheAdapter mAdapter; public static HashMap<Long, Boolean> shown = new HashMap<Long, Boolean>(); ... @Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Boolean tmp = shown.get(id); if (tmp == null) { // if null we don't have this key in the hashmap so we added with the value true shown.put(id, true); } else { shown.put(id, !tmp.booleanValue()); // if the value exists in the map then inverse it's value } mAdapter.notifyDataSetChanged(); } } And my adapter class extends CursorAdapter and overrides bindView @Override public void bindView(View view, Context context, Cursor cursor) { String listText= cursor .getString(cursor .getColumnIndexOrThrow(DataHandler.MY_TEXT)); long id = curs

Getting the Selected View from ListView

I am using a CursorAdapter to handle my ListActivity: public class Mclass extends ListActivity{ ... TheAdapter mAdapter; public static HashMap<Long, Boolean> shown = new HashMap<Long, Boolean>(); ... @Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Boolean tmp = shown.get(id); if (tmp == null) { // if null we don't have this key in the hashmap so we added with the value true shown.put(id, true); } else { shown.put(id, !tmp.booleanValue()); // if the value exists in the map then inverse it's value } mAdapter.notifyDataSetChanged(); } } And my adapter class extends CursorAdapter and overrides bindView @Override public void bindView(View view, Context context, Cursor cursor) { String listText= cursor .getString(cursor .getColumnIndexOrThrow(DataHandler.MY_TEXT)); long id = curs

Unable to install SDK Platform 4.0.3

I'm trying to install the SDK for android 4.0.3 but I get an error and it does not download nor install. Unexpected Error installing 'SDK Platform Android 4.0.3, API 15, revision 2': org.eclipse.swt.SWTException: Widget is disposed This is the error. Anyone know how to fix it ? :) EDIT: Problem fixed, don't know why nor do I know why the problem even occured.

Unable to install SDK Platform 4.0.3

I'm trying to install the SDK for android 4.0.3 but I get an error and it does not download nor install. Unexpected Error installing 'SDK Platform Android 4.0.3, API 15, revision 2': org.eclipse.swt.SWTException: Widget is disposed This is the error. Anyone know how to fix it ? :) EDIT: Problem fixed, don't know why nor do I know why the problem even occured.

My bluetooth connexion is reading only zeros

From my Android phone, I'm trying to read (using Bluetooth) incomming strings from an external GPS device. I've followed mainly the BluetoothChat example and everything seems to work as expected so far. My reading thread is executing and I can see variable bytes packets incoming when looping with the following code: Log.d(TAG, "BEGIN mConnectedThread"); byte[] buffer = new byte[1024]; int bytes; // Keep listening to the InputStream while connected while (true) { try { bytes = mmInStream.read(buffer); // Test... String strReadBuf = new String(buffer, 0, bytes); // Send the obtained bytes to the UI Activity mHandler.obtainMessage(BluetoothHandler.MessageType.READ, bytes, buffer).sendToTarget(); } catch (IOException e) { Log.e(TAG, "disconnected", e); sendErrorMessage(R.string.bt_connection_lost); break; } } The strings I'm supposed to read

My bluetooth connexion is reading only zeros

From my Android phone, I'm trying to read (using Bluetooth) incomming strings from an external GPS device. I've followed mainly the BluetoothChat example and everything seems to work as expected so far. My reading thread is executing and I can see variable bytes packets incoming when looping with the following code: Log.d(TAG, "BEGIN mConnectedThread"); byte[] buffer = new byte[1024]; int bytes; // Keep listening to the InputStream while connected while (true) { try { bytes = mmInStream.read(buffer); // Test... String strReadBuf = new String(buffer, 0, bytes); // Send the obtained bytes to the UI Activity mHandler.obtainMessage(BluetoothHandler.MessageType.READ, bytes, buffer).sendToTarget(); } catch (IOException e) { Log.e(TAG, "disconnected", e); sendErrorMessage(R.string.bt_connection_lost); break; } } The strings I'm supposed to read

How can I listen the Android output (using sniffer)?

I wrote simple application that send some data to my server. Somehow the data is corrupted and I want to use something like sniffer on the Android cellphone device to look what exactly is the data that my application is sending. When I run with debug - I see the data is right - but on the other side (on the server) I see that the data is corrupted. Is there some way to use sniffer that will catch the packets that are sent from the Android device? i using the wireshark on the server side - but its look like something in the android side is making the problem. I need to use sniffer somehow on the android side

PayPal initialization fails always in android live wallpaper project

I am trying to integrate PayPal in app payment in a live wallpaper project that I am working on. Whenever I try to initialize the paypal library with: pp = PayPal.initWithAppID(this, appID, server); it always fails to initialize. In logs I can't see any error and my code is good because if I take the payment activity out and put it in a separate project, a regular (no live wallpaper service) and put the same user permissions in the manifest file it initializes without any fuss. What am I missing ? Is "WallpaperService" class running with some restrictions that affect paypal initialization ?

Who can I create a Share Android App to send to my clients or colleagues? Like iOS AdHoc

I'm over an Android App for a client, eventually I want to show him some demo, but he doesn't have the IDE, so I'm thinking to send him an APK ... In iOS it's pretty easy through AdHoc and the Mobile ID... I just want to send him an APK for him to install in his phone... (Not Android Market YET) How can I do this on Android? Thanks!

PayPal initialization fails always in android live wallpaper project

I am trying to integrate PayPal in app payment in a live wallpaper project that I am working on. Whenever I try to initialize the paypal library with: pp = PayPal.initWithAppID(this, appID, server); it always fails to initialize. In logs I can't see any error and my code is good because if I take the payment activity out and put it in a separate project, a regular (no live wallpaper service) and put the same user permissions in the manifest file it initializes without any fuss. What am I missing ? Is "WallpaperService" class running with some restrictions that affect paypal initialization ?