[android-developers] Instrumentation: can this mechanism be used for something else than testing ?

2011-10-31 Thread pperotti
Hi Everyone,

I'm trying to use (without success) the instrumentation mechanism to
intercept events for a subset of views (for instance, when the end
user clicks on any button) but without  luck.

I'm starting to wonder if it is possible to use instrumentation to
intercept events of methods from views ( for instance Buttons ).

The use case I'm trying to solve is gather statistics from a subset of
events from a subset of views without overriding each method of each
button in the application.

Does anybody knows if this is possible ?

Thanks in advance,
Pablo

-- 
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] Broadcast Receivers

2010-04-21 Thread pperotti
Hi Everyone,

Can anyone give a hint if you know why there are some ACTIONS that do
not trigger their associated receivers when they are registered in the
manifest while they are received when they are register through
registerReceiver() ?

For instance, when I declare:

receiver android:name=.MyReceiver
intent-filter
action android:name=android.intent.action.NEW_OUTGOING_CALL /
/intent-filter
/receiver

if the application is NOT running MyReceiver is never invoked.

But now, if I register the intent from inside a service, MyReceiver is
invoked properly.

Any tip will be appreciated.

Regards, Pablo

-- 
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] Moto Milestone

2010-01-08 Thread pperotti
Hi Everyone,

Does anybody know how to identify consistently when a device is a
motorola milestone ? None of the parameters in the Build class seems
to report consistently among the devices that are currently in the
market.

I have seen that some devices identifies as A853 and other as
Milestone. Any appreciation will be welcome.

Regards, Pablo
-- 
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] Mobile Network Setting

2009-12-28 Thread pperotti
Hi Everyone,

I just want to ask you if you anyone knows how to change the Setting
available in: Settings-Wireless Settings-Mobile Network from code or
Setting: Settings-Wireless Settings-Mobile Network Settings-Network
operators-Select Automatically?

I had been unable to find a property that match this setting in the
Settings.System / Settings.Secure classes.

Is there any alternative way to turn on/off the MOBILE
connectivity ? The reason I need to solve this is to workaround the
bug occur during transitioning from WIFI to MOBILE that do not enable
CELL data automatically.

Thanks in advance,

Pablo

-- 
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] QSB and Images in suggestion provider

2009-10-28 Thread pperotti

hi Everyone,

I was playing with the QSB and content providers and I found a problem
at the time of using suggestions providers. What I want to achieve is
what the contact app have which is to show an image in a suggestion
with the particular need that the image is not a resource, I have them
stored in a database so, basically I have them as bytes.

As far as I understood a row (in a matrix cursor) for the field
SUGGEST_COLUMN_ICON_1 can be completed using a content, a resource id
or a file.

When I try to set the value for that image as content://com.mycompany/
items/1 the content provider that is supposed to handle this is not
ever invoked.

Can anyone give a any clue about what I am doing wrong or how can I
achieve this ? If

Regards, Pablo
--~--~-~--~~~---~--~~
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: List View not properly updated from AsyncTask

2009-07-14 Thread pperotti

Hi Romain,

I am actually using in List3 adapter.notifyDatasetChanged(). This do
not freeze the app but do not allow the user to scroll perfectly as in
List1. For some reason (the amount of operations probably in the
AsyncTask) the ListView is not entirely independent from the data set
affecting the user's interaction.

Any comment about why this happens ?

Pablo

On 14 jul, 02:21, Romain Guy romain...@google.com wrote:
 Do NOT call invalidateViews(), it calls ListView to throw everything
 away. Use Adapter.notifyDatasetChanged() instead.

 On Mon, Jul 13, 2009 at 10:15 PM,pperottipablo.pero...@gmail.com wrote:

  Hi Everyone,

  After digging with the APIs I still cannot figure out how the
  AsyncTask properly works and why some behavior occur.

  I'm trying  to achieve one contact list that can be updated from a
  background async task very frequently. There are situations where
  invoking UI updates from the background thread just freeze the UI as
  you see in example #2. or make the list not to react properly to
  finger as a regular contact list. Can anyone give me some hint on how
  to achieve the expected behavior?

  I added here the activities that form my project (sorry for the lenght
  of the post, my idea was to share the complete problem with everyone)

  Example 1: Contact list without background task. This code contains
  the behavior of a default contact list. This code produce the expected
  behavior in responsive for the user but do not update. This activity
  shows the ideal response for a contact list.

  package com.pp.lists;

  import android.app.ListActivity;
  import android.content.Intent;
  import android.hardware.SensorManager;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.Button;

  public class List1 extends ListActivity implements
  View.OnClickListener {

     Button btnBack = null;
     SensorManager sensorManager = null;

     String[] items = { lorem, ipsum, dolor, sit, amet,
  consectetuer, adipiscing, elit, morbi, vel,
             ligula, vitae, arcu, aliquet, mollis, etiam,
  vel, erat, placerat, ante, porttitor,
             sodales, pellentesque, augue, purus, lorem,
  ipsum, dolor, sit, amet, consectetuer,
             adipiscing, elit, morbi, vel, ligula, vitae,
  arcu, aliquet, mollis, etiam, vel,
             erat, placerat, ante, porttitor, sodales,
  pellentesque, augue, purus, lorem, ipsum,
             dolor, sit, amet, consectetuer, adipiscing,
  elit, morbi, vel, ligula, vitae, arcu,
             aliquet, mollis, etiam, vel, erat, placerat,
  ante, porttitor, sodales, pellentesque,
             augue, purus, lorem, ipsum, dolor, sit,
  amet, consectetuer, adipiscing, elit, morbi,
             vel, ligula, vitae, arcu, aliquet, mollis,
  etiam, vel, erat, placerat, ante,
             porttitor, sodales, pellentesque, augue,
  purus };

     /** Called when the activity is first created. */
    �...@override
     public void onCreate( Bundle savedInstanceState ) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.listdemo);
         setListAdapter(new ArrayAdapterString(this,
  R.layout.listitem, R.id.label, items));

         btnBack = (Button) findViewById(R.id.btnBackFromList);
         btnBack.setOnClickListener(this);
     }

     public void onClick( View arg0 ) {
         if ( btnBack == arg0 ) {
             startActivity(new Intent(this, Main.class));
         }
     }

     public void onResume() {
         System.out.println(List1.onResume!);
         super.onResume();
     }

     public void onPause() {
         System.out.println(List1.onPause!);
         super.onPause();
     }

  }

  Example 2: This example update the contact list very frequently
  properly but without freezing DO NOT allow the user to even scroll.

  package com.pp.lists;

  import android.app.ListActivity;
  import android.content.Intent;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.os.Handler;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ListView;

  public class List2 extends ListActivity implements
  View.OnClickListener {

     Button btnBack = null;
     Handler handler = new Handler();

     String[] items = { lorem, ipsum, dolor, sit, amet,
  consectetuer, adipiscing, elit, morbi, vel,
             ligula, vitae, arcu, aliquet, mollis, etiam,
  vel, erat, placerat, ante, porttitor,
             sodales, pellentesque, augue, purus, lorem,
  ipsum, dolor, sit, amet, consectetuer,
             adipiscing, elit, morbi, vel, ligula, vitae,
  arcu, aliquet, mollis, etiam, vel,
             erat, placerat, ante, porttitor, sodales,
  pellentesque, augue, purus, lorem, ipsum,
             dolor, sit, amet, consectetuer, adipiscing,
  elit, morbi, vel, ligula, vitae, arcu,
             aliquet, mollis, etiam, vel, erat, placerat,
  

[android-developers] List View not properly updated from AsyncTask

2009-07-13 Thread pperotti

Hi Everyone,

After digging with the APIs I still cannot figure out how the
AsyncTask properly works and why some behavior occur.

I'm trying  to achieve one contact list that can be updated from a
background async task very frequently. There are situations where
invoking UI updates from the background thread just freeze the UI as
you see in example #2. or make the list not to react properly to
finger as a regular contact list. Can anyone give me some hint on how
to achieve the expected behavior?

I added here the activities that form my project (sorry for the lenght
of the post, my idea was to share the complete problem with everyone)

Example 1: Contact list without background task. This code contains
the behavior of a default contact list. This code produce the expected
behavior in responsive for the user but do not update. This activity
shows the ideal response for a contact list.

package com.pp.lists;

import android.app.ListActivity;
import android.content.Intent;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;

public class List1 extends ListActivity implements
View.OnClickListener {

Button btnBack = null;
SensorManager sensorManager = null;

String[] items = { lorem, ipsum, dolor, sit, amet,
consectetuer, adipiscing, elit, morbi, vel,
ligula, vitae, arcu, aliquet, mollis, etiam,
vel, erat, placerat, ante, porttitor,
sodales, pellentesque, augue, purus, lorem,
ipsum, dolor, sit, amet, consectetuer,
adipiscing, elit, morbi, vel, ligula, vitae,
arcu, aliquet, mollis, etiam, vel,
erat, placerat, ante, porttitor, sodales,
pellentesque, augue, purus, lorem, ipsum,
dolor, sit, amet, consectetuer, adipiscing,
elit, morbi, vel, ligula, vitae, arcu,
aliquet, mollis, etiam, vel, erat, placerat,
ante, porttitor, sodales, pellentesque,
augue, purus, lorem, ipsum, dolor, sit,
amet, consectetuer, adipiscing, elit, morbi,
vel, ligula, vitae, arcu, aliquet, mollis,
etiam, vel, erat, placerat, ante,
porttitor, sodales, pellentesque, augue,
purus };

/** Called when the activity is first created. */
@Override
public void onCreate( Bundle savedInstanceState ) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listdemo);
setListAdapter(new ArrayAdapterString(this,
R.layout.listitem, R.id.label, items));

btnBack = (Button) findViewById(R.id.btnBackFromList);
btnBack.setOnClickListener(this);
}

public void onClick( View arg0 ) {
if ( btnBack == arg0 ) {
startActivity(new Intent(this, Main.class));
}
}

public void onResume() {
System.out.println(List1.onResume!);
super.onResume();
}

public void onPause() {
System.out.println(List1.onPause!);
super.onPause();
}

}

Example 2: This example update the contact list very frequently
properly but without freezing DO NOT allow the user to even scroll.

package com.pp.lists;

import android.app.ListActivity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;

public class List2 extends ListActivity implements
View.OnClickListener {

Button btnBack = null;
Handler handler = new Handler();

String[] items = { lorem, ipsum, dolor, sit, amet,
consectetuer, adipiscing, elit, morbi, vel,
ligula, vitae, arcu, aliquet, mollis, etiam,
vel, erat, placerat, ante, porttitor,
sodales, pellentesque, augue, purus, lorem,
ipsum, dolor, sit, amet, consectetuer,
adipiscing, elit, morbi, vel, ligula, vitae,
arcu, aliquet, mollis, etiam, vel,
erat, placerat, ante, porttitor, sodales,
pellentesque, augue, purus, lorem, ipsum,
dolor, sit, amet, consectetuer, adipiscing,
elit, morbi, vel, ligula, vitae, arcu,
aliquet, mollis, etiam, vel, erat, placerat,
ante, porttitor, sodales, pellentesque,
augue, purus, lorem, ipsum, dolor, sit,
amet, consectetuer, adipiscing, elit, morbi,
vel, ligula, vitae, arcu, aliquet, mollis,
etiam, vel, erat, placerat, ante,
porttitor, sodales, pellentesque, augue,
purus };

private ArrayAdapter adapter = null;
private ListView list = null;

BGSorter task = null;

EditText txtTest = null;
public boolean isRunning = true;

/** Called when the activity is first created. */
@Override
public void onCreate( Bundle savedInstanceState ) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listdemo);
adapter = new ArrayAdapterString(this, R.layout.listitem,
R.id.label, items);
setListAdapter(adapter);

[android-developers] Question about MotionEvents

2009-04-18 Thread pperotti

hi everyone,

Can anyone give me a clue about how can I do to make a list scroll
down or up programatically ?

I'm trying to understand how to trigger the same motion event that
happen when a list scrolls down or up as a consecuence o a touch.

Thanks for the help.
Pablo
--~--~-~--~~~---~--~~
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: WebView bug with pageDown() ?

2009-04-03 Thread pperotti

I did that also but if you invoke view.pageDown(true) inside
onPageFinished(Webview view, STring url ) it produces the same
behavior as explained before. The only way this method seems to work
(producing a very poor user-experience)  is by just invoking inside
the onPageFinished something like the following:

In the activity using a WebView object named webView:

class ViewUpdater implements Runnable {
public void run() {
webView.pageDown(true);
}
}

and a class extending the WebViewClient ...

void onPageFInished(WebView view, String url) {
view.postDelayed(new ViewUpdater(), 150);
//The following does not work either.
//view.post(new ViewUpdater());
}

But this produces that after reloading data with webview.loadData(),
the contents and the scrollbar are shown on top and just after 150
millisecs everything is scrolled down to the bottom which actually
produce a poor user experience.

Should I open a bug on this ?

Regards, Pablo

On 2 abr, 21:06, Mark Murphy mmur...@commonsware.com wrote:
 pperotti wrote:
  Is there any way to be notified when a page has been completely loaded
  using web view?

 Attach a WebViewClient to your WebView, and override onPageFinished() in
 the WebViewClient.

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

 Android App Developer Training:http://commonsware.com/training.html
--~--~-~--~~~---~--~~
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: WebView bug with pageDown() ?

2009-04-02 Thread pperotti

That is what it means but if you pass true to the boolean argument
it means that the page will be scrolled to the bottom. It seems that
after invoking loadData(), the contents is moved to the bottom but
once the web view has finished loading its data, the scroll is
resetted to the top.

Is there any way to be notified when a page has been completely loaded
using web view?

On 2 abr, 01:42, Romain Guy romain...@google.com wrote:
 pageDown() does not mean scroll the web page to the bottom it means
 scroll down by one page. Just like the page down key on a computer
 keyboard.

 On Wed, Apr 1, 2009 at 9:33 PM, pperotti pablo.pero...@gmail.com wrote:

  Hi Everyone,

  Does anybody know how can I sort out a problem with the
  WebView.pageDown( boolean ) method that simple does not remains in the
  bottom of the web view after invoking loadData() ?

  The behavior in the emulator moves to the bottom and right after that
  moves back to the top.

  Thanks in advance,
  Pablo

 --
 Romain Guy
 Android framework engineer
 romain...@android.com

 Note: please don't send private questions to me, as I don't have time
 to provide private support.  All such questions should be posted on
 public forums, where I and others can see and answer them
--~--~-~--~~~---~--~~
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] WebView bug with pageDown() ?

2009-04-01 Thread pperotti

Hi Everyone,

Does anybody know how can I sort out a problem with the
WebView.pageDown( boolean ) method that simple does not remains in the
bottom of the web view after invoking loadData() ?

The behavior in the emulator moves to the bottom and right after that
moves back to the top.

Thanks in advance,
Pablo
--~--~-~--~~~---~--~~
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 do I make my application to be restarted after the phone is powered-on again?

2009-03-29 Thread pperotti

Hi Everyone,

Can anyone give me a hint about what should I do to make my
application to be restarted automatically after the phone has been
powered-off and powered-on again ?

I read that regular alarms do not survive phone reboots so, I'm
assuming there should be a way to do it.

Thanks in advance,
Pablo
--~--~-~--~~~---~--~~
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: How do I make my application to be restarted after the phone is powered-on again?

2009-03-29 Thread pperotti

Thanks Mark, I have just read also the response in the last update of
your latest book.

On 29 mar, 20:01, Mark Murphy mmur...@commonsware.com wrote:
 pperotti wrote:
  Can anyone give me a hint about what should I do to make my
  application to be restarted automatically after the phone has been
  powered-off and powered-on again ?

  I read that regular alarms do not survive phone reboots so, I'm
  assuming there should be a way to do it.

 You have to register a BroadcastReceiver to get control when the phone
 reboots and then re-register your alarms.

 We just had an extended thread on this very list on a related topic:

 http://groups.google.com/group/android-developers/browse_thread/threa...

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

 Warescription: Three Android Books, Plus Updates, $35/Year
--~--~-~--~~~---~--~~
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] Activity and Services

2009-02-20 Thread pperotti

Hi Everyone,

I was digging on the group about similar question but I couldn't find
the solution to my problem so this was the reason Im posting this
question. Please if my problem is already answer just post me the
link.

I have library running on a service and I need to read some objects
from this framework from Activities.

When I try to create the interface .aidl the Eclipse framework and the
aidl.exe tool says: unknown type.

For instance:

interface IMyService {
MyObject getObject();
}

If I added import mypackage.MyObject before the interface declaration,
I got the error: coulnd't import mypackage.MyObject.

What is this couldn't import classes problem ? How can I read Objects
created in a service from an Activity ?

Thanks in advance.
Pablo
--~--~-~--~~~---~--~~
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: how can I check if an Activity is visible or not?

2009-02-16 Thread pperotti

Well, that is actually not a bad idea. Thanks for the tip !

On Feb 16, 12:58 am, Marco Nelissen marc...@android.com wrote:
 Since you're going to do this from your service, why don't you have your
 Activity register with the service when it is started or resumed, unregister
 when it is paused or stopped, and then just have the service keep track of
 whether the activity is active that way?

 On Sun, Feb 15, 2009 at 6:44 PM, pperotti pablo.pero...@gmail.com wrote:

  Well ... maybe to clarify what Im trying to get done. I want just to
  launch a notification to the user only if he is not in one of the
  screens (Activities) of my application. If the user find himself
  using the application I just want to move him to the next screen.
  Basically ...

  if ( the user is using my app) {
     startActivity(new Intent(...) );
  }
  else{
    // Launch the appropriate notification just not to be intrusive
  }

  I was checking in the Activity/ActivityManager public interface, but I
  dont quite get how to check if the user is actually using my
  application of not.

  Can you explain me a bit more how to do this with the approach you
  mention ? or if there is an alternative way to do it ?

  Thanks again for the time.
  Pablo

  On Feb 13, 12:57 am, Dianne Hackborn hack...@android.com wrote:
   Please don't do this, these APIs are only really for writing system
   information tools.  For example, for this to work correctly need to
  retrieve
   -all- possible running activities (which can be 10, 20, 30, or more),
  have
   all of that information copied to your process, and look through it for
  the
   activity you are interested in.

   If your code is in a service a good way to do this is to just have the
   activity tell the service when it is resumed.

   On Thu, Feb 12, 2009 at 6:50 PM, Dan Raaka micromys...@gmail.com
  wrote:

Get the RunningTaskInfo through the ActivityManager
and do a name match for the activity name you want to exclude and send
the notification

-Dan

On Feb 12, 5:34 pm, pperotti pablo.pero...@gmail.com wrote:
 Hi, does anybody knows if it is possible to check if an Activity is
  at
 a moment of the time visible ?

 My question is because I want to implement a service and only invoke
  a
 different activity (by launching an Intent) only if the previous
 activity was visible. In case for instance, the user is in a
  different
 application I just want to send a notification.

 My problem is that I dont know how to determine if my application is
 being use at a particular time, so, I can properly move to the user
  to
 the right screen.

 Thanks !
 Pablo

   --
   Dianne Hackborn
   Android framework engineer
   hack...@android.com

   Note: please don't send private questions to me, as I don't have time to
   provide private support.  All such questions should be posted on public
   forums, where I and others can see and answer them.
--~--~-~--~~~---~--~~
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: Problem with sound on Notifications on Emulator

2009-02-15 Thread pperotti

Thanks for your reply ! I guess that the scenario is different. In my
case, I want to reproduce a sound located in my /res/raw directory.
The default sound works as expected.

My problem is that I couldn't get to work an external sound, for
instance, the sound /res/raw/beback.mp3. What would be the URL for
that sound ?

Regards, Pablo

On Feb 8, 5:41 am, Chander Pechetty cspeche...@gmail.com wrote:
 The API Demos has examples. Checkout StatusBarNotifications and
 NotifyingService.

 For your example
 Vibrating:
 // if vibrate on- after a 100ms delay, vibrate for 200ms, pause for
 150
 // ms and then vibrate for 500ms.
 notification.vibrate = new long[] { 100,200,150, 500 };

 if you are not particular about playing your sound,
 soundUri = content://settings/system/notification_sound
 notification.sound = soundUri;

 You can use the following to just use default vibration and sounds.
  notification.defaults = Notification.DEFAULT_ALL

 I haven't noticed in logcat any messages for Vibrate, but it works on
 the device.

 Cheers,
 Chander
--~--~-~--~~~---~--~~
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: how can I check if an Activity is visible or not?

2009-02-15 Thread pperotti

Well ... maybe to clarify what Im trying to get done. I want just to
launch a notification to the user only if he is not in one of the
screens (Activities) of my application. If the user find himself
using the application I just want to move him to the next screen.
Basically ...

if ( the user is using my app) {
startActivity(new Intent(...) );
}
else{
   // Launch the appropriate notification just not to be intrusive
}

I was checking in the Activity/ActivityManager public interface, but I
dont quite get how to check if the user is actually using my
application of not.

Can you explain me a bit more how to do this with the approach you
mention ? or if there is an alternative way to do it ?

Thanks again for the time.
Pablo

On Feb 13, 12:57 am, Dianne Hackborn hack...@android.com wrote:
 Please don't do this, these APIs are only really for writing system
 information tools.  For example, for this to work correctly need to retrieve
 -all- possible running activities (which can be 10, 20, 30, or more), have
 all of that information copied to your process, and look through it for the
 activity you are interested in.

 If your code is in a service a good way to do this is to just have the
 activity tell the service when it is resumed.



 On Thu, Feb 12, 2009 at 6:50 PM, Dan Raaka micromys...@gmail.com wrote:

  Get the RunningTaskInfo through the ActivityManager
  and do a name match for the activity name you want to exclude and send
  the notification

  -Dan

  On Feb 12, 5:34 pm, pperotti pablo.pero...@gmail.com wrote:
   Hi, does anybody knows if it is possible to check if an Activity is at
   a moment of the time visible ?

   My question is because I want to implement a service and only invoke a
   different activity (by launching an Intent) only if the previous
   activity was visible. In case for instance, the user is in a different
   application I just want to send a notification.

   My problem is that I dont know how to determine if my application is
   being use at a particular time, so, I can properly move to the user to
   the right screen.

   Thanks !
   Pablo

 --
 Dianne Hackborn
 Android framework engineer
 hack...@android.com

 Note: please don't send private questions to me, as I don't have time to
 provide private support.  All such questions should be posted on public
 forums, where I and others can see and answer them.
--~--~-~--~~~---~--~~
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 can I check if an Activity is visible or not?

2009-02-12 Thread pperotti

Hi, does anybody knows if it is possible to check if an Activity is at
a moment of the time visible ?

My question is because I want to implement a service and only invoke a
different activity (by launching an Intent) only if the previous
activity was visible. In case for instance, the user is in a different
application I just want to send a notification.

My problem is that I dont know how to determine if my application is
being use at a particular time, so, I can properly move to the user to
the right screen.

Thanks !
Pablo




--~--~-~--~~~---~--~~
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] Problem with sound on Notifications on Emulator

2009-02-07 Thread pperotti

Hi Everyone,

The reason Im posting this question is because I cannot make a
notification to reproduce a sound or a vibration sequence.

For the case of the vibration I have permissions properly set and
logcat do not show log message indicating a problem.

For the case of sound, I have an mp3 saved in the res/raw folder and I
always got an error saying: error loading sound in logcat.

I add an snipplet with the code I´m using. Probably anyone can let me
know if I am making a newbie mistake.

Notification note=new Notification(R.drawable.red_ball, Status
message!, System.currentTimeMillis());

note.vibrate = new long[] {100,200,150};

Uri uri = Uri.parse(android.resource://com.pp/ +
R.raw.test_cbr);
note.sound = uri;

PendingIntent i=PendingIntent.getActivity(this, 0,
new Intent(this, NotifyMessage.class), 0);

note.setLatestEventInfo(this, Notification Title, This is the
notification message, i);

mgr.notify(NOTIFY_ME_ID, note);

Where com.pp is the package of my application.

I will be more than glad if someone can be me a hint or a working
snipplet about reproducing sound, vibration and lights. There is
actually very few documentation about how to make notifications work
properly.

Thanks in advance, Pablo

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