.i write a app but it is not doing anything..code is given below if anybody
can help.....
*manifest file:::*
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<receiver android:name="myBR" >
<intent-filter>
<action
android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.intent.category.HOME"/>
</intent-filter>
</receiver>
<service android:name="myService">
<action android:name="com.serceatboot.myService"/>
</service>
<activity android:name="myactivity"></activity>
</application>
<uses-sdk android:minSdkVersion="4" />
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
*
Broadcast reciever*:::
public class myBR extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
Intent serviceIntent=new Intent();
serviceIntent.setAction("com.serviceatboot.myService");
intent.setClass(context,myService.class);
context.startService(serviceIntent);
}
}
*
and service*:::public class myService extends Service{
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
Toast.makeText(this, "service created", Toast.LENGTH_SHORT).show();
}
@Override
public void onStart(Intent intent, int startId) {
// TODO Auto-generated method stub
super.onStart(intent, startId);
Toast.makeText(this, "service started", Toast.LENGTH_SHORT).show();
}
@Override
public void onDestroy() {
// TODO Auto-generated method stub
Toast.makeText(this, "service Destroyed", Toast.LENGTH_SHORT).show();
super.onDestroy();
}
}
*please let me know if am doing anything wrong or missed something...*
--
Ankit
--
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