Hello,
I'm new here so greetings to all.
Here is my problem:
I want to: Start MyApp after boot.
Code below gives me:
1. when I manualy run MyApp it works correctly. Gives me Alert HELLO.
2. After reboot system gives my info:
"The application MyApp (process test.test) has stopped unexpectedly.
Please try again."
Any idea ? I have tried almost all ( commented lines) and still
nothing.
Here goes the Code:
MyApp.java:
[code]
package test.test;
public class TabletDambonia extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Biblioteka.make_alert("HELLO", "blebleble", this );
}
}
[/code]
Biblioteka.java:
[code]
package test.test;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.Gravity;
import android.widget.Toast;
public class Biblioteka {
public static void generuj_alert( String title, String msg,
TabletDambonia tablet_dambonia ){
AlertDialog alertDialog = new
AlertDialog.Builder( tablet_dambonia ).create();
alertDialog.setTitle(title);
alertDialog.setMessage(msg);
alertDialog.setIcon(R.drawable.quan);
alertDialog.setButton("OK", new
DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
return;
} });
alertDialog.show();
}
}
[/code]
BootUpReceiver.java:
[code]
package quanGodziny.quanGodziny;
import java.util.Calendar;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class BootUpReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
AlarmManager am = (AlarmManager)
context.getSystemService(Context.ALARM_SERVICE);
// Intent serviceIntent = new Intent(context,
TabletDambonia.class);
// PendingIntent pi = PendingIntent.getService(context, 0,
serviceIntent, PendingIntent.FLAG_UPDATE_CURRENT);
// Calendar calendar = Calendar.getInstance();
Intent serviceIntent = new Intent(context, TabletDambonia.class);
PendingIntent pi = PendingIntent.getActivity(context, 0,
serviceIntent, PendingIntent.FLAG_UPDATE_CURRENT);
Calendar calendar = Calendar.getInstance();
long triggerAtTime = calendar.getTimeInMillis() + (1 * 1 * 60 *
1000); // starts in 60 sec
// am.setInexactRepeating(AlarmManager.RTC_WAKEUP, triggerAtTime,
repeat_alarm_every, pi);
am.set(AlarmManager.RTC_WAKEUP, triggerAtTime, pi);
}
}
[/code]
--
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