Re: [android-developers] client certificate authentication for ssl/https connection

2010-02-23 Thread saify.zeenwala
hi

just create certificate using bouncy castle algo as android supports only
BKS certificates only.

use below mentioned link to generate client side certificat and store it
using keystore.
http://crazybob.org/2010/02/android-trusting-ssl-certificates.html

regards



On Tue, Feb 23, 2010 at 12:35 PM, Babasaheb  wrote:

> Hi,
>
> I want to connect to a server using ssl/https connection. During
> handshake between client and the server, I want to have server
> certificate authentication as well as client certificate
> authentication. The server certificate authentication is successful.
> But I don't know how to send client certificate to server for
> authentication, during the handshake.
> Can anybody please provide some tutorial for the same?
>
> Thanks,
> Babasaheb
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] SSL3_READ_BYTES error

2010-03-04 Thread saify.zeenwala
Hi

First chek for ur client side certificate.
Android only support BKS certificate.

First ensure for client side certificate and use following code
this will work


SSLSocketFactory SSLSF = *new* SSLSocketFactory(trusted);

schemeRegistry.register(*new* Scheme("https", SSLSF, 443));

ClientConnectionManager manager = *new* ThreadSafeClientConnManager(

parameters, schemeRegistry);

HttpClient httpClient = *new* DefaultHttpClient(manager, parameters);

 httpClient.getParams().setParameter("http.connection.timeout",
*new*Integer(3000));

HttpGet ping = *new* HttpGet("https://10.10.60.7:8443";);

HttpResponse response = httpClient.execute(ping);

*int* status = response.getStatusLine().getStatusCode();

*if* (status == 200) {

InputStream content = response.getEntity().getContent();

*int* c = -1;

StringBuffer buffer = *new* StringBuffer();

*while* ((c = content.read()) != -1) {

buffer.append((*char*) c);

}

content.close();

Log.*i*("EXAMPLE", buffer.toString());

} *else* {

Log.*i*("EXAMPLE", status + "");

}
regards

On Wed, Mar 3, 2010 at 4:31 PM, gemini  wrote:

> Hello,
>
>I'm working on an application which communicates with remote
> server to fetch data.
> Server requires a client certificate authentication. I'm adding the
> certificate to the keystore. But while connecting, I always get
>
>  java.io.IOException: SSL handshake failure: Failure in SSL
> library,usually a protocol error
>  error:14094412:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake
> failure (external/openssl/ssl/s3_pkt.c:1053 0x1be510:0x0003)
>
>  Similar code works without any issue from desktop client.
>  Below is snippet :-
>
> ==
>
>
>  SSLSocketFactory sslSocketFactory = new SSLSocketFactory(key,"test");
>
>   HttpParams parameters = new BasicHttpParams();
>
>SchemeRegistry schemeRegistry = new SchemeRegistry();
>
>   schemeRegistry.register(new Scheme("https", sslSocketFactory,
> 443));
>
>ClientConnectionManager manager = new
> ThreadSafeClientConnManager(parameters, schemeRegistry);
>
> HttpClient httpClient = new
> DefaultHttpClient(manager,parameters);
>
> HttpGet ping = new 
> HttpGet("https://192.168.1.45:443
> ");
>  HttpResponse response = httpClient.execute(cmd);   --> error is
> thrown here
>
> ==
>
>   Any help is appreciated. Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Background Service is not working.

2009-11-25 Thread saify.zeenwala
hi


put ur code in onstart() instead of oncreate()

becuase ur on create will get call only once through out the life cycle of
service.

hope this will help u




On Tue, Nov 24, 2009 at 2:25 PM, Wei Jian  wrote:

> Hello. i wish to use implement Service in my application to display a
> message on the screen. This service should run while my application is
> running. But right now, i just want to test the service function and
> the Service doesn't seem to work well.
>
> In the main java file, i call startService(new Intent
> (this,testing.class));
>
> And the testing.java code is as below.
>
> package com.example.helloandroid;
>
> //import android.app.NotificationManager;
> import android.app.Service;
> import android.content.Intent;
> import android.os.IBinder;
> import android.widget.Toast;
>
> public class testing extends Service{
>
>
>@Override
>public void onCreate() {
>Toast mToast = Toast.makeText(this, R.string.app_name,
>Toast.LENGTH_LONG);
>mToast.show();
>}
>
>
>@Override
>public IBinder onBind(Intent arg0) {
>// TODO Auto-generated method stub
>return null;
>}
>
>
> }
>
>
> Why it isn't displaying the Toast message? Can anyone help please!!!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] how to fetch datas from database like mysql/sqlite

2009-11-25 Thread saify.zeenwala
hi

try out these simple line of code


QLiteDatabase m_oSQLiteDatabase;

m_oSQLiteDatabase.query(strTableName, arrColumns, *null*, *null*, *null*, *
null*, *null*);

this will return u cursor object

use get method to retive data from cursor




On Tue, Nov 24, 2009 at 5:38 PM, siva  wrote:

> HI
>
>   how to fetch datas  from database like mysql / sqlite.can any
> one help me in this,i have tried the examples gave in the NOTEPAD
> sample.its not working(it dont shows any errors.)
>
>
> can any one guide me in this ...
>
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Deleting Incoming SMS - Android

2009-11-25 Thread saify.zeenwala
hi

use below mentioned method

this will give u object[] of smsmessage

*

private* SmsMessage[]getMessagesFromIntent(Intent intent)

{

SmsMessage retMsgs[] = *null*;

Bundle bdl = intent.getExtras();

*try*{

Object pdus[] = (Object [])bdl.get("pdus");

retMsgs = *new* SmsMessage[pdus.length];

*for*(*int* n=0; n < pdus.length; n++)

{

*byte*[] byteData = (*byte*[])pdus[n];

retMsgs[n] = SmsMessage.*createFromPdu*(byteData);

}

}

*catch*(Exception e)

{

Log.*e*("DEBUG", "fail", e);

}

*return* retMsgs;

}


use getDisplayMessageBody() to get ur message.








On Tue, Nov 24, 2009 at 3:27 PM, MaNjO  wrote:

> Hi
>   I require to delete an incoming SMS based on certain parameters
> that I define.
> Is it possible to do this?
>
> I have tinkered around with onReceive() events but I cannot get the
> incoming message to get deleted. The best I could do was to delete all
> the exisitng messages in the Inbox.
>
> Can someone help?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Background listener getting killed

2009-11-26 Thread saify.zeenwala
hi

have u tried android:enabled = true attribute in recieve tag of ur
broadcaster 


regards

On Thu, Nov 26, 2009 at 12:00 AM, Ravi  wrote:

> I have an app that listens to incming Calls. If the user has another
> app that listens to the same (Call popup applicaitons in specific) my
> process is getting killed - any solutions or ideas on how to prevent
> this ?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] undx.jar

2010-09-23 Thread saify.zeenwala
Hi Guys

I am looking for undx.jar

I have tried hard on sourceforge as well as on illegalaccess.com too but not
found any thing.

Can any one please share it with me.

Regards

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Mount USB Drive

2010-07-23 Thread saify.zeenwala
u can use linux mount command directly avail in /system/etc

regards


On Tue, Jul 13, 2010 at 2:39 PM, perumal316  wrote:

> Hi All,
>
> I want my application to automatically mount the phone into USB
> storage drive if USB cable is connected.
>
> Is there code to do it? I tried searching but couldn't find any info
> on it.
>
> Thanks In Advance,
> Perumal
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Upload Images to server

2010-08-03 Thread saify.zeenwala
Hi

Don't get confused
Used below pasted code


HttpURLConnection oHttpConnection = null;
OutputStream oOutputStream = null;
FileInputStream oFileInputStream = null;
java.io.InputStream oInputStream = null;

boolean bSuccess = true;
byte[] arrBuf = null;

try
{
File oCurrentFile = null;
   oCurrentFile = new File(oFileMetaData.m_strFile);


// make server connection
oHttpConnection = Connector.fnOpen(oFileMetaData.m_strURL,
Connector.POST);

//open output stream
oOutputStream = oHttpConnection.getOutputStream();

//open fileInputStream
oFileInputStream = new FileInputStream(oCurrentFile);

// Max Buffer Size
int iBufferSize = 1024;
// Buffer
arrBuf = new byte[iBufferSize];

int nReadBytes = -1;

/*
 * read chunk by chunk till
 * end of file and upload chunk-by-chunk
 * to server
 */
///*for debugging*/
///*===*/
//int size = 0;
///*===*/
while(-1 != (nReadBytes = oFileInputStream.read(arrBuf)))
{
oOutputStream.write(arrBuf, 0, nReadBytes);

///*for debugging*/
///*===*/
//size+=nReadBytes;
//Logger.Log("chunk size:::"+ nReadBytes + ":::total
size:::" + size);
///*===*/
}
oOutputStream.flush();
oOutputStream.close();
oFileInputStream.close();
arrBuf = null;

// get connection response code
int nStatus = oHttpConnection.getResponseCode();

switch (nStatus)
{
// 200 = Ok (Successful)
case HttpURLConnection.HTTP_OK:
{
// Read data from the input stream
oInputStream = oHttpConnection.getInputStream();

int nSize = oHttpConnection.getContentLength();

arrBuf = new byte[nSize];
int len = 0;

while(len < nSize)
{
arrBuf[len++] = (byte)oInputStream.read();
}

//cross check that all the data read properly from
server
if(len < nSize)
bSuccess = false;

break;
}
// 400: The request could not be understood by the
server due to
// malformed syntax.
case HttpURLConnection.HTTP_BAD_REQUEST:
{
bSuccess = false;
break;
}
// 401: The request requires user authentication.
case HttpURLConnection.HTTP_UNAUTHORIZED:
{
bSuccess = false;
break;
}
// 403: The server understood the request, but is
refusing to
// fulfill it.
case HttpURLConnection.HTTP_FORBIDDEN:
{
bSuccess = false;
break;
}
// 404: The server has not found anything matching the
// Request-URI.
case HttpURLConnection.HTTP_NOT_FOUND:
{
bSuccess = false;
break;
}
// 502: The server, while acting as a gateway or proxy,
received
// an
// invalid response from the upstream server it accessed
in
// attempting
// to fulfill the request
case HttpURLConnection.HTTP_BAD_GATEWAY:
{
bSuccess = false;
break;
}
// 503: The server is currently unable to handle the
request due
// to
// a temporary overloading or maintenance of the server
case HttpURLConnection.HTTP_UNAVAILABLE:
{
bSuccess = false;
break;
}
}
} catch (Exception e)
{
bSuccess = false;
Logger.Log("Exception in downloading File::: Donwloader UTIL:::"
+ e);
throw new Exception("");
} finally
{
try
{
// close inputStream
if (null != oInputStream)
{
try
{
oInputStream.close()

Re: [android-developers] How to store questions for quiz type application

2010-08-03 Thread saify.zeenwala
Hi

Better opt for SQL as it would be convenient for you to do further SQL
query.
where as in property file you have to do manual search and have to do string
operation.

create table with 3 columns

question
 possibleanswer
correct answer

Might be this will help you



On Tue, Aug 3, 2010 at 2:19 AM, amos  wrote:

> Hello,
> I want to create such application that would show a question to user
> and possible 3 (or n) answers and user should pick correct answer
> (some kind of learning quiz). I'm not sure about the storage for those
> data - questions and possible answers. What would be most natural way
> for Android. I know that I can either use property files or tables in
> sqlite database. There will be about 500 items (1 question, 3 answers,
> 1 correct answer ).
> Any ideas?
> Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Interaction between an Activity and a Service ?

2010-08-03 Thread saify.zeenwala
Hi

Use shared preference.

It is the easiest way to handle ur problem




On Tue, Aug 3, 2010 at 12:25 PM, Paul Turchenko wrote:

> See ApiDemos for 2way service communication sample.
>
> On Aug 1, 11:29 pm, Rajesh Bachani  wrote:
> > Hello friends!
> >
> > I am trying to explore how information can be exchanged between
> > activities and services.
> > So, if we have Activity A and a Service S is started from A, using the
> > startService() method - is there a way to pass parameters to the
> > Service - and also receive values from the Service into the Activity
> > once the stopService() method is called?
> >
> > I am using Intent to start the service, as one would expect.
> >
> > And further what is the advantage of calling the onBind method, as
> > opposed to the onStart().
> >
> > Thanks,
> > Rajesh.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: sdcard MEDIA_MOUNTED, File.canRead = true, File.canWrite = false

2010-08-09 Thread saify.zeenwala
hi

try with

/mnt/sdcard

This will help you out


On Sat, Aug 7, 2010 at 6:55 AM, john brown wrote:

> I got a command prompt via c:\Program Files\Android-SDK\tools> adb
> shell
>
> # ls -l /sdcard/Android/data/lms
> rwxr-x systemsdcard_rw63   2010-07-19 15:17
> mpReadAbDdx201006.txt
> rwxr-x systemsdcard_rw 45211   2010-07-19 15:17
> mpTranAbDdx201006.txt
>
> The way I read this is that the owner's rights are ---, group is rwx,
> others is r-x. I'm just guessing, the application is others?
> But I cannot get chmod to change the attributes, i.e.:
>
> # chmode o-rwx /sdcard/Android/data/lms/mpReadAbDdx201006.txt
> Bad mode
>
> Where can I find documentation to the Android linux (?) commands? (I
> mean the command line commands)
>
> Thanks, John
>
> On Aug 6, 6:12 pm, DanH  wrote:
> > Sounds like you forgot to insert the write ring.  (Oops!  Wrong
> > technology!)
> >
> > Is the file write-protected maybe?
> >
> > On Aug 6, 5:13 pm, john brown  wrote:
> >
> >
> >
> > > Hello,
> >
> > > I am using Android 2.1 update 1, API level 7, Eclipse, and HVGA skin.
> >
> > > When the AVD is running, I check settings > sdcard total 49.21MB,
> > > available 49.07MB.
> >
> > > Programatically checking Environment.getExternalStorageState() equals
> > > MEDIA_MOUNTED which I think means that the sdcard is available and
> > > writeable.
> >
> > > I use getExternalStorageDirectory() to establish the sdcard root
> > > directory.
> >
> > > I copied the files on the sdcard with adb push source destination.
> >
> > > I am able to successfully read other files in that directory.
> >
> > > code to write to file:
> > > //*
> >
> > > File fFile = new File(pathFile);
> > > if (fFile.exists()){ ... // returns true
> > > if (fFile.canRead()){ ... // returns true
> > > if (fFile.canWrite()){ ... // returns false
> >
> > > try{
> > > FileWriter Fw = new FileWriter(fFile, true);
> > > BufferedWriter Bw = new BufferedWriter(Fw);
> > > PrintWriter outPw = new PrintWriter(Bw, true);
> > > outPw.println(strRec);
> > > outPw.close();}
> >
> > > catch(IOException ex){
> > > System.out.println("IO Error - " + ex.toString());
> > > System.exit(0);
> >
> > > }
> >
> > > //
> > > System.out shows:
> > > IO Error - java.io.FileNotFoundException
> >
> > > but we know the file is there from the preceding checks:
> > > if (fFile.exists()){ ... // returns true
> > > if (fFile.canRead()){ ... // returns true
> >
> > > What do I need to do to make the file writable?
> > > Or
> > > I want to write to the file. What am I doing wrong?
> >
> > > Thanks, John Brown- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] SSL Certificate Installation Problem

2010-11-03 Thread saify.zeenwala
Hi

you can by-pass

but if you want to check certificate
then use the following code to store certificate in keystore

KeyStore trusted = KeyStore.getInstance("BKS");
  InputStream in = getResources().openRawResource(R.raw.cerrrt);
  trusted.load(in, "ez24get".toCharArray());
 SSLSocketFactory SSLSF =  new SSLSocketFactory(trusted);

schemeRegistry.register(new Scheme("https", SSLSF, 443));

Regards

On Wed, Nov 3, 2010 at 1:35 PM, Android Humanoid wrote:

> Hi All,
>
> when am accessing a web service am getting "Not Trusted Server
> Certificate" error, For this should I install the certificate on the
> mobile or system, or can I bypass this.
>
> Thanks & Regards.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Where to Check for files/data created in emulator?

2010-05-05 Thread saify.zeenwala
use ddms tool to check create files and dir.




On Tue, May 4, 2010 at 9:23 PM, dillipk  wrote:

> Hello,
>  Where can I check for the Dir/ files/ data created in Internal
> Memory/SDCard ?
>
> Thanks in advance..
>
> Regards,
> DK
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en