[android-developers] Automatic wake up app on server action or Push Registry in Android

2011-09-30 Thread Animesh Sinha
Hi all

 I am developing an application in that there is a requirement
that server will send a message to the device at a specific port and
our app will respond on such message and invoke our app automatically.
But i am come to know that Android Application doesn't have Push
Registry system like J2ME.

   Is there any other way to do the same thing i.e. server will ping
to device and our app will wake up on.


Thanks in Advance.
Please help me.

-- 
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] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-22 Thread Animesh Sinha
Thanks Chris for replying.

You are right in saying that android requires developers to write an
event-driven code and that effort needs to be put for designing the
whole chain of events.

But for the following case as shown below, I don't think one can get
rid of the NullPointerException thrown in onClick() method of
MyServiceClient; Unless instead of storing Service Interface globally,
one stores it locally.

---
CODE SNIPPET (UPDATED)
---
//class MyServiceClient in separate file - Used for accessing the
service via a wrapper class
class MyServiceClient extends Activity
{
 //store a reference to service interface
 private ISomeServiceInterface mService = null; //
reference stored globally here

 public void onCreate(Bundle savedInstanceState)
 {
//some lines
ServiceWrapperClass svc = new
ServiceWrapperClass(getApplicationContext());
//access the service
mService = svc.getService()//the
getService() method returns null
//Integer someValue = mService.someFunc(1,
2); //Moved the line into onClick() method

//using a button's onClick event to call some function on the
service
Button btn = (Button)findViewById(R.id.someBtn);
btn.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
Integer someValue = 
mService.someFunc(1, 2); //
NullPointerException still thrown here as mService was null
}
 });
}

}

//class ServiceWrapperClass in separate file - Used for binding to
service and providing the service instance to client
class ServiceWrapperClass
{
private static ISomeServiceInterface myService;

//constructor
public ServiceWrapperClass(Context context) {
//create intent to connect to service
Intent serviceIntent = new Intent(some.uri);
context.bindService(serviceIntent,
progressBarServiceConn,
Context.BIND_AUTO_CREATE);
//access the service
Integer someValue = myService.someFunc(1,
2); // NullPointerException here - How to make sure
service should be running before any function is called on the
service ?
}

private ServiceConnection progressBarServiceConn = new
ServiceConnection(){
@Override
public void onServiceConnected(ComponentName name,
IBinder service)
{
myService =
 
ISomeServiceInterface.Stub.asInterface(service);
}
@Override
public void onServiceDisconnected(ComponentName name)
{
myService = null;
}
};
public ISomeServiceInterface getService()
{
return myService;
}
}

On Jul 22, 11:54 am, Chris Stratton cs07...@gmail.com wrote:
 On Thursday, July 21, 2011 1:26:54 AM UTC-4, Animesh Sinha wrote:
  The issue is that I need to call the service methods as soon as it is
  connected.
  So, Is there any way by which I can execute the functions of service
  JUST AFTER binding is complete ?

  It takes around 10-20ms for binding, I tried to make use
  Thread.sleep(30); but it delayed the service from being connected by
  the same sleep duration, therefore not solving the problem.

 The problem is that android requires you to write event driven code here.  
 It can't deliver a new event until you return from the current event.  If
 you sleep, you just delay the return, and thus the new event delivery which
 can only occur after that.

 You are going to have to do a lot of re-thinking of how to architect this
 whole process as a chain of events.  Yes, it's painful, but you'll get
 better at that kind of re-shuffling with time.







  On Jul 20, 6:33 pm, Mark Murphy mmu...@commonsware.com wrote:
   On Tue, Jul 19, 2011 at 12:21 PM, animeshsi anime...@gmail.com wrote:
Is there some way by which I can make sure that the service binding is
complete before any access is made to functions provided by the
service ?

   Don't try using the Binder until onServiceConnected() is called.
  http://commonsware.com/training

-- 
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] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-21 Thread Animesh Sinha
Executing the function calls in onServiceConnected() method is not
what is wanted as described in following case:


CODE SNIPPET

class ServiceWrapperClass
{
private ISomeServiceInterface myService
..
private ServiceConnection progressBarServiceConn = new
ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name,
IBinder service)
{
myService =
ISomeServiceInterface.Stub.asInterface(service);
}
@Override
public void onServiceDisconnected(ComponentName name)
{
myService = null;
}
};
 public void onCreate(Bundle savedInstanceState) {

//create intent to connect to service
Intent serviceIntent = new Intent(some.uri);
bindService(serviceIntent, progressBarServiceConn,
Context.BIND_AUTO_CREATE);
//access the service
Integer someValue = myService.someFunc(1, 2); //
NullPointerException here - How to make sure service should be
running
before any function is called on the service ?
  }



On Jul 21, 3:16 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Thu, Jul 21, 2011 at 1:26 AM, animeshsi animeshs...@gmail.com wrote:
  The issue is that I need to call the service methods as soon as it is
  connected.
  So, Is there any way by which I can execute the functions of service
  JUST AFTER binding is complete ?

 Execute those functions in onServiceConnected().

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 Android Training in London:http://bit.ly/smand1,http://bit.ly/smand2

-- 
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] Re: Help needed for dealing with NullPointerException when calling functions on a service just after binding it

2011-07-21 Thread Animesh Sinha
Executing the function calls in onServiceConnected() method is not
what is wanted as described in following case:

There is a Service Wrapper class where the binding/unbinding is
actually done.
The MyServiceClient is an Activity class used for invoking some
functions on the service using the Service Wrapper class, instead of
directly binding/unbinding to service.

In this case, a service client using the wrapper class cannot execute
the function calls on the service in onServiceConnected() method,
which is in a different file.

The NullPointerException is therefore still thrown when any function
is invoked on the service after initializing the service wrapper.

---
CODE SNIPPET (UPDATED)
---
//class MyServiceClient in separate file - Used for accessing the
service via a wrapper class
class MyServiceClient extends Activity
{

public void onCreate(Bundle savedInstanceState) {
//some lines
ServiceWrapperClass svc = new
ServiceWrapperClass(getApplicationContext());

//access the service
Integer someValue = svc.getService().someFunc(1, 2);
 //
NullPointerException here - How to make sure service should be running
before any function is called on the service ?
}
}


//class ServiceWrapperClass in separate file - Used for binding to
service and providing the service instance to client
class ServiceWrapperClass
{
private static ISomeServiceInterface myService;

//constructor
public ServiceWrapperClass(Context context) {
//create intent to connect to service
Intent serviceIntent = new Intent(some.uri);
context.bindService(serviceIntent, progressBarServiceConn,
Context.BIND_AUTO_CREATE);
//access the service
Integer someValue = myService.someFunc(1, 2); //
NullPointerException here - How to make sure service should be running
before any function is called on the service ?
}

private ServiceConnection progressBarServiceConn = new
ServiceConnection(){
@Override
public void onServiceConnected(ComponentName name,
IBinder service)
{
myService =
ISomeServiceInterface.Stub.asInterface(service);
}
@Override
public void onServiceDisconnected(ComponentName name)
{
myService = null;
}
};

public ISomeServiceInterface getService()
{
return myService;
}
}


On Jul 21, 3:16 pm, Mark Murphy mmur...@commonsware.com wrote:
 On Thu, Jul 21, 2011 at 1:26 AM, animeshsi animeshs...@gmail.com wrote:
  The issue is that I need to call the service methods as soon as it is
  connected.
  So, Is there any way by which I can execute the functions of service
  JUST AFTER binding is complete ?

 Execute those functions in onServiceConnected().

 --
 Mark Murphy (a Commons 
 Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy

 Android Training in London:http://bit.ly/smand1,http://bit.ly/smand2

-- 
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] want notification to application from home screen

2011-06-09 Thread Animesh Sinha
Hi all,

 i am new in android and i am developing an application in that i have a
requirement to open/launch my app as soon as user type some specific number
on Home screen say(*#12324#) such that it will notify to my app for launch.

I mean to say that i want a notification(Command) same as when we
type *#06# in home screen it will show a IMEI no. in the same way when
i press a certain code (eg: *#12345#) then it will notify to my
service which is running in background.

Plz solve my problem and reply me soon.

Thanks and Regards
Animesh

-- 
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] want notification to application from home screen

2011-06-09 Thread Animesh Sinha
Thanks Mark
 for quick reply, but building an Home application for this and tell
user to change the their home application for this particular app is not
feasible i think so.

Regards
Animesh

On Thu, Jun 9, 2011 at 7:36 PM, Mark Murphy mmur...@commonsware.com wrote:

 On Thu, Jun 9, 2011 at 10:04 AM, Animesh Sinha
 animesh.andr...@gmail.com wrote:
   i am new in android and i am developing an application in that i
 have a
  requirement to open/launch my app as soon as user type some specific
 number
  on Home screen say(*#12324#) such that it will notify to my app for
 launch.

 SDK applications cannot do this, unless it is your own home screen app.

 --
 Mark Murphy (a Commons Guy)
 http://commonsware.com | http://github.com/commonsguy
 http://commonsware.com/blog | http://twitter.com/commonsguy

 _The Busy Coder's Guide to *Advanced* Android Development_ Version
 1.9.3 Available!

 --
 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] How to Obfuscate Android project source in eclipse

2011-03-23 Thread Animesh Sinha
Hi all
 I want to know How to Obfuscate Android project source in
eclipse, i have searched many sites but i wont get the solution for
the same.

   Please help me...

-- 
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 Obfuscate Android project source in eclipse

2011-03-23 Thread Animesh Sinha
Thanx Marcin
  For quick reply, can you please tell me how to config or tune ProGuard
in our project.

Thanks and Regards
   Animesh Sinha.

On Wed, Mar 23, 2011 at 5:40 PM, Marcin Orlowski
webnet.andr...@gmail.comwrote:


 On 23 March 2011 12:00, Animesh Sinha animesh.andr...@gmail.com wrote:

 Hi all
 I want to know How to Obfuscate Android project source in
 eclipse,



 if source means source code then be aware such action is quite pointless.
 If you meant binary - use ProGuard it's already built-in, yet, for some
 projects you may need to tune its config a bit.

 Regards,
 Marcin Orlowski

 Tray Agenda http://bit.ly/trayagenda - keep you daily schedule handy...

  --
 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] How I get Command in Home Screen In Android

2010-12-28 Thread Animesh Sinha
I mean to say that i want a notification(Command) same as when we
type *#06# in home screen it will show a IMEI no. in the same way when
i press a certain code (eg: *#12345#) then it will notify to my
service which is running in background.

Plz solve my problem and reply me soon.



Waiting

-- 
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] How I get Command in Home Screen In Android

2010-09-10 Thread Animesh Sinha

I mean to say that i want a notification(Command) same as when we
type *#06# in home screen it will show a IMEI no. in the same way when
i press a certain code (eg: *#12345#) then it will notify to my
service which is running in background.

Plz solve my problem and reply me soon.



Waiting

-- 
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