I want to create a app without any UI and It should be work as a service application.I have used boot completed event in the app, When I run the app in 2.3(Gingerbread) version then its working propely but its not working on Jellybean version.But if I run the app with any activity then it works propely in both versions.Please give me a solution.
AndroidManifest file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.bootreceivecheck"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<receiver android:name="com.home.BootReceiver.BootCompleteReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>
</manifest>
class file.
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
public class BootCompleteReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent arg1) {
try
{
Toast.makeText(context, "Mobile Boot Completed", Toast.LENGTH_LONG).show();
}catch(Exception ex)
{
Toast.makeText(context, ex.getMessage(), Toast.LENGTH_LONG).show();
}
}
}