Now this comes up :(

>From Base Class on Some Method

Intent myIntent = new Intent(this, TimeAlarm.class);

PendingIntent  pendingIntent = PendingIntent.getService(this, 0, myIntent,
0);
AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
calendar.add(Calendar.SECOND, 10);
         //  alarmManager.set(AlarmManager.RTC_WAKEUP,
calendar.getTimeInMillis(), pendingIntent);
           alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
calendar.getTimeInMillis(),
       (10), pendingIntent);


  Toast.makeText(this, "Start Alarm", Toast.LENGTH_LONG).show();


AlarmClass:

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.IBinder;
import android.widget.Toast;


public class TimeAlarm extends Service
{
public void onStart(Intent intent, int startId) {

// TODO Auto-generated method stub

super.onStart(intent, startId);

Toast.makeText(this, "MyAlarmService.onStart()", Toast.LENGTH_LONG).show();

}

@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}
}


Error

"publisher closed input channel or an error occurred "
and android got rebooted

RK

On Thu, Jul 5, 2012 at 9:28 PM, G. Blake Meike <[email protected]>wrote:

> +1
>
> Starting your own thread is broken: it won't work across process
> boundaries.
>
> G. Blake Meike
> Marakana
>
> The second edition of Programming Android is now on-line:
> http://shop.oreilly.com/product/0636920023005.do
>
>
> On Thursday, July 5, 2012 6:09:47 AM UTC-7, rahul kaushik wrote:
>>
>>
>> Intent intent = new Intent(this, TimeAlarm.class);
>>   PendingIntent pendingIntent = PendingIntent.getBroadcast(**this,
>> 0,intent, PendingIntent.FLAG_ONE_SHOT);
>>
>>   am.set(AlarmManager.RTC_**WAKEUP,System.**currentTimeMillis() + (1 *
>> 1000), pendingIntent);
>>
>> TimeAlarm.class is insame life as other classs
>>
>>  am.set(AlarmManager.RTC_**WAKEUP,System.**currentTimeMillis() + (1 *
>> 1000), pendingIntent);
>> this line giving me error=null
>>
>> RK
>>
>>  --
> 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
>

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

Reply via email to