AlarmManager/pendingIntent help?

Put your problem here if it does not fit any of the other categories.

AlarmManager/pendingIntent help?

Postby Clee12 » Tue Jan 25, 2011 12:32 am

I'm simply trying to open a different app when an alarm triggers. AKA, when alarm triggers, start an activity, such as Pandora Radio. I guess my problem is being caused by my lack of knowledge in pendingintents, because I can't even get a new class and methods to start running when the alarm supposedly triggers. Any help would be appreciated. Here is the code that is supposed to open and run the new class.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  mAlarmSender = PendingIntent.getService(panda.this,
  2.                                         0, new Intent(panda.this, openPanda.class), Intent.FLAG_ACTIVITY_NEW_TASK);
  3.                                
  4.                                
  5.                                 //stateDisplay.setText("Time until alarm executes:"+triggerRtime);
  6.                                 long firstTime = SystemClock.elapsedRealtime();
  7.                                 triggerAtTime = triggerRtime + firstTime;
  8.                                 //stateDisplay.setText("Time until alarm executes:"+triggerRtime);
  9.                             AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
  10.                                 am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerAtTime, mAlarmSender);
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


does this look like it would do what I'm trying to get it to do?

and here is my openPanda.class
Code: Select all
package pandlarm.test;

import android.content.Intent;
import android.app.Activity;

        public class openPanda extends Activity {
   TextView stateDisplay;
   
   

   public void main(){
      stateDisplay.setText("Made it to 'openPanda'");
      Intent myIntent = new Intent();
      myIntent.setClassName("com.pandora.android", "com.pandora.android.Main");
      startActivity(myIntent);
   }
   
   

}
Clee12
Freshman
Freshman
 
Posts: 2
Joined: Tue Jan 25, 2011 12:16 am

Top

Re: AlarmManager/pendingIntent help?

Postby Clee12 » Fri Jan 28, 2011 1:17 am

anyone?
Clee12
Freshman
Freshman
 
Posts: 2
Joined: Tue Jan 25, 2011 12:16 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 24 guests