Well, that was a bust ...
I am pretty sure that *my* BR is not getting called... pls check my
work::
This is the Manifest => (assume the correct permissions in that I do
get the SMS when this is working in the foreground)
<receiver android:name=".clsSMSRCV">
<intent-filter>
<action
android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
My MAINACTIVITY declares the BR as so...
private clsSMSRCV myClsSMSRCV;
and then in the MainActivity.onCreate() ==
myClsSMSRCV = new clsSMSRCV();
This is the clsSMSRCV definition with the receive override:
public class clsSMSRCV extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// I tear apart the SMS message(s) here... and alter Statics for
review outside this routine
}
}
One last thing, I can think of...
Main has a runnable which is essentially monitoring the Statics and so
can then act upon them changing in ClsSMSRCV.
In my last experiment I had the onReceive() try to express a
Notification.... nuttin happened.
On Sep 11, 4:21 pm, tony obrien <[email protected]> wrote:
> Understood (and thanks for the in-depth response !)
>
> I had already run into (and repaired) the case where I was "sitting"
> around too long.
>
> And so now, I will try the NOTIFICATION route since I successfully use
> that elsewhere...
>
> Hopefully I can reawaken the MAIN activity and gather up the STATICs
> (and I made them static just for the reason you explain) and have my
> UI aspects offer the correct choices to my user.
>
> thanks, again.
>
> On Sep 11, 4:09 pm, Kostya Vasilyev <[email protected]> wrote:
>
> > Tony,
>
> > Android apps are composed of individual components - activities,
> > services, broadcast receivers, etc. Their lifetimes are managed by
> > Android in response to events that are relevant for a particular type of
> > component.
>
> >http://developer.android.com/guide/topics/fundamentals.html#appcomp
>
> > A broadcast receiver getting an event does not mean that some or other
> > activity or a service should be started automatically, just because it's
> > a component of the same application.
>
> > After all, you wouldn't want all activities declared within your
> > application to be invoked at once, right? Same with other component
> > types. Each does its own thing, and they are glued together by the code
> > you write.
>
> > The issue with debugging a broadcast receiver is that Android limits the
> > amount of time that an application can take in its callbacks (broadcast
> > receiver's onReceive, activity lifecycle callbacks such as onStart,
> > etc.) If you take too long in the debugger, Android kills the process
> > thinking it's not responding.
>
> > My suggestion is to add logging calls (using Android's built-in log
> > class) to your receiver's onReceive, verify that does get called, and
> > take it from there.
>
> >http://developer.android.com/reference/android/util/Log.html
>
> > If you would like to notify the user that an SMS has been received, you
> > have two options:
>
> > - Start an activity using Context.startActivity - which is what you seem
> > to be trying to do, but which is considered in Android to be bad user
> > experience.
>
> > - Use a status bar notification, which would in turn launch the activity
> > to show the message:
>
> >http://developer.android.com/guide/topics/ui/notifiers/notifications....
>
> > Finally, as for statics - this is a Java thing. Static members are, by
> > definition, independent of any particular instance of the class they are
> > declared in.
>
> > Hope this helps,
> > -- Kostya
>
> > 11.09.2010 23:40, tony obrien пишет:
>
> > > One more thing ... if I happen to be in the NetBeans IDE /
> > > Debugger.... I can be at a breakpoint and (all of a sudden) its been
> > > knocked out of debugging mode -- i.e. the App really has "died"
>
> > > On Sep 11, 3:37 pm, tony obrien<[email protected]> wrote:
> > >> Thanks, but I already HAVE such a thing in my Manifest...
>
> > >> I suppose that my BR intent *could be* lurking while my MAIN dies...
> > >> but then why doesn't the MAIN get REStarted when the BR starts
> > >> updating Main's (static) variables ? Main is *not* starting and so
> > >> its just as if the SMS was never received...
>
> > >> any ideas?
>
> > >> On Sep 11, 3:02 pm, Kostya Vasilyev<[email protected]> wrote:
>
> > >>> Well, all-you-gotta-do is:
> > >>> Register your receiver in the manifest, like so:
> > >>> <receiver android:name=".YourSmsMessageReceiverClassName">
> > >>> <intent-filter>
> > >>> <action android:name="android.provider.Telephony.SMS_RECEIVED" />
> > >>> </intent-filter>
> > >>> </receiver>
> > >>> ( Taken
> > >>> from:http://developer.android.com/resources/samples/ApiDemos/AndroidManife...
> > >>> )
> > >>> Receivers declared in the manifest are active all the time, for as long
> > >>> as the application is installed (and not disabled in the manifest). You
> > >>> don't need to take any kind of special action for them to receive
> > >>> events.
> > >>> In the onReceive() method of your broadcast receiver, you are free to do
> > >>> whatever you like: such as starting a service to do some kind of
> > >>> processing (I actually recommend this).
> > >>> The application process will be started by Android as necessary.
> > >>> -- Kostya
> > >>> 11.09.2010 22:25, tony obrien пишет:
> > >>>> I am hoping someone may respond and say … "Well, all-you-gotta-do is
> > >>>> Blah_Blah…" Is there a way to make the OS "not" clean me out of
> > >>>> memory? Is the answer to make the b-receiver a "service"? And is that
> > >>>> allowable in Android?
> > >>> --
> > >>> Kostya Vasilyev -- WiFi Manager + pretty widget
> > >>> --http://kmansoft.wordpress.com
>
> > --
> > Kostya Vasilyev -- WiFi Manager + pretty widget
> > --http://kmansoft.wordpress.com
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en