ok, i did it by starting an activity after the service.
Intent fireAlarm = new Intent(context,
AlarmActivity.class);
fireAlarm.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(fireAlarm);
but Can I make this whole activity look like an alert showing in the
middle, as a dialog appears in an activity ?
i tried,
// Popup alert over black screen
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
lp.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
lp.token = null;
getWindow().setAttributes(lp);
getWindow().addFlags
(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
but the area outside the dialog is seen black, how can it be
transparent ?
On Dec 17, 8:41 am, Jags <[email protected]> wrote:
> nobody attempted it before ? how can i get the source code for alarm
> clock app ? is that in java for android ?
>
> On Dec 16, 10:06 pm, Jags <[email protected]> wrote:
>
> > how is alarm clock showing its ui in android then ?
>
> > little baffling though.
>
> > On Dec 16, 10:35 pm, Jags <[email protected]> wrote:
>
> > > I dont understand even if my application is not gone to background or
> > > finished, still, the alert is not showing up !
>
> > > On Dec 16, 8:42 pm, Jags <[email protected]> wrote:
>
> > > > well more surprise. toast does not seem to work from AppService, but
> > > > it works from OneTimeAlarmReceiver
>
> > > > am i doing something stupid here ?
>
> > > > On Dec 16, 7:57 pm, Jags <[email protected]> wrote:
>
> > > > > to help with a little code
>
> > > > > ____________________________
>
> > > > > public class AppService extends WakefulIntentService {
> > > > > public AppService() {
> > > > > super("AppService");
> > > > > }
>
> > > > > private void showMePopup(Row rec) {
> > > > > final FrameLayout fl = new FrameLayout(this);
> > > > > final TextView input = new TextView(this);
> > > > > input.setGravity(Gravity.CENTER);
> > > > > input.setSingleLine(true);
>
> > > > > fl.addView(input, new FrameLayout.LayoutParams
> > > > > (FrameLayout.LayoutParams.FILL_PARENT,
> > > > > FrameLayout.LayoutParams.WRAP_CONTENT));
>
> > > > > input.setText(rec.message);
> > > > > new AlertDialog.Builder(this)
> > > > > .setView(fl)
> > > > > .setTitle(R.string.app_name)
> > > > > .setPositiveButton("OK", new
> > > > > DialogInterface.OnClickListener(){
> > > > > //@Override
> > > > > public void onClick(DialogInterface d, int
> > > > > which) {
> > > > > d.dismiss();
> > > > > }
> > > > > }).create().show();
> > > > > }
> > > > > ____________________________
>
> > > > > is it kinda bad context ? as this refers to instance of
> > > > > WakefulIntentService ? if yes how can I get proper context instance ?
>
> > > > > i am using Mark's code wakefulintentservice from github
>
> > > > > regards
>
> > > > > On Dec 16, 7:46 pm, Jags <[email protected]> wrote:
>
> > > > > > Now that I am able to send an sms from inside AppService, I am
> > > > > > unable
> > > > > > to show an alert upon an alarm.
>
> > > > > > i get the exception 12-16 19:41:37.890: DEBUG/RemindMe(5317): Unable
> > > > > > to add window -- token null is not for an application
>
> > > > > > am I not allowed to show alert in AppService ?
> > > > > > I understand Mark opined against it, but how to convince my boss
> > > > > > about
> > > > > > this :) . I am able to show a toast though
>
> > > > > > regards
>
> > > > > > On Dec 13, 2:15 am, Jags <[email protected]> wrote:
>
> > > > > > > Ok ! Now that I am able to fire up the alarm, how can I fire up
> > > > > > > the
> > > > > > > alarm with a little more context ? Like for example, I want to
> > > > > > > have my
> > > > > > > alarm give me a record id when it wakes me up ! How can I acheive
> > > > > > > that
> > > > > > > in a broadcast receiver ?
>
> > > > > > > regardsJagat
>
> > > > > > > On Dec 9, 7:14 pm, Jags <[email protected]> wrote:
>
> > > > > > > > very bad, blackberry allows this but. this is where blackberry
> > > > > > > > scored
> > > > > > > > better than android :)
>
> > > > > > > > On Dec 9, 5:10 pm, "Mark Murphy" <[email protected]>
> > > > > > > > wrote:
>
> > > > > > > > > > but it invokes the mail ui of android, cant I silenly send
> > > > > > > > > > email as i
> > > > > > > > > > am sending sms ?
>
> > > > > > > > > Not unless you bundle in your own email JAR and use that. The
> > > > > > > > > only
> > > > > > > > > built-in ways to send emails in Android will involve user
> > > > > > > > > input.
>
> > > > > > > > > --
> > > > > > > > > Mark Murphy (a Commons Guy)http://commonsware.com
> > > > > > > > > Android App Developer Books:http://commonsware.com/books.html
>
>
--
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