{"id":33254,"date":"2016-02-08T15:00:57","date_gmt":"2016-02-08T13:00:57","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=33254"},"modified":"2019-04-24T15:56:49","modified_gmt":"2019-04-24T12:56:49","slug":"android-start-service-boot-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/","title":{"rendered":"Android Start Service on Boot Example"},"content":{"rendered":"<p>In the mobile device world, many times, we may need to make an application that has to do some tasks in the background, without the users to have to open their application. Some easy examples are the background Location tracking, or an alarm application, or the applications that want to receive push events from a server.<\/p>\n<p>This can be done with the use of a service that will run in the background and will start on device boot, or on application update in a device. In order to achieve this, we are going to register a BroadcastReceiver to listen to <code>RECEIVE_BOOT_COMPLETED<\/code> events and then start a service to do whatever we may want our service to do.<\/p>\n<p>So, in this example, we are going to show how to make an application that has an Android service that starts service at device boot.<\/p>\n<p>For our example will use the following tools in a Windows 64-bit or an  OS X platform:<\/p>\n<ul>\n<li>JDK 1.7<\/li>\n<li>Android Studio 1.3.2<\/li>\n<li>Android SDK 5.0<\/li>\n<\/ul>\n<p>Let\u2019s take a closer look:\n<\/p>\n<h2>1. Create a New Android Studio Project<\/h2>\n<div class=\"tip\"><strong>Tip<\/strong><br \/>\nYou may skip project creation and jump directly to the <a href=\"#code\"><strong>beginning of the example<\/strong><\/a> below.<\/div>\n<p>Open Android Studio and choose \u201cStart a new Android Studio Project\u201d in the welcome screen.<\/p>\n<p><figure id=\"attachment_27646\" aria-describedby=\"caption-attachment-27646\" style=\"width: 797px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/10\/androidstudioexs1.png\" rel=\"attachment wp-att-27646\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/10\/androidstudioexs1.png\" alt=\"\u201cWelcome to Android Studio\u201d screen. Choose \u201cStart a new Android Studio Project\u201d.\" width=\"797\" height=\"601\" class=\"size-full wp-image-27646\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/10\/androidstudioexs1.png 797w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/10\/androidstudioexs1-300x226.png 300w\" sizes=\"(max-width: 797px) 100vw, 797px\" \/><\/a><figcaption id=\"caption-attachment-27646\" class=\"wp-caption-text\">\u201cWelcome to Android Studio\u201d screen. Choose \u201cStart a new Android Studio Project\u201d.<\/figcaption><\/figure><\/p>\n<p>Specify the name of the application, the project and the package.<\/p>\n<p><figure id=\"attachment_33462\" aria-describedby=\"caption-attachment-33462\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostart1.jpg\" rel=\"attachment wp-att-33462\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostart1.jpg\" alt=\"\u201cConfigure your new project\u201d screen. Add your application name and the projects package name.\" width=\"800\" height=\"608\" class=\"size-full wp-image-33462\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostart1.jpg 800w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostart1-300x228.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostart1-768x584.jpg 768w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><figcaption id=\"caption-attachment-33462\" class=\"wp-caption-text\">\u201cConfigure your new project\u201d screen. Add your application name and the projects package name.<\/figcaption><\/figure><\/p>\n<p>In the next window, select the form factors your app will run on.<\/p>\n<p><figure id=\"attachment_27648\" aria-describedby=\"caption-attachment-27648\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/10\/androidstudioexs3.png\" rel=\"attachment wp-att-27648\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/10\/androidstudioexs3.png\" alt=\"\u201cTarget Android Devices\u201d screen.\" width=\"800\" height=\"512\" class=\"size-full wp-image-27648\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/10\/androidstudioexs3.png 800w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/10\/androidstudioexs3-300x192.png 300w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><figcaption id=\"caption-attachment-27648\" class=\"wp-caption-text\">\u201cTarget Android Devices\u201d screen.<\/figcaption><\/figure><\/p>\n<p>In the next window you should choose \u201cAdd no activity\u201d. In this example, we are going to create our Activity.<\/p>\n<p><figure id=\"attachment_27650\" aria-describedby=\"caption-attachment-27650\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/10\/androidstudioex4.png\" rel=\"attachment wp-att-27650\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/10\/androidstudioex4.png\" alt=\"\u201cAdd an activity to Mobile\u201d. Choose: \u201cAdd no activity\u201d.\" width=\"800\" height=\"512\" class=\"size-full wp-image-27650\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/10\/androidstudioex4.png 800w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2015\/10\/androidstudioex4-300x192.png 300w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><figcaption id=\"caption-attachment-27650\" class=\"wp-caption-text\">\u201cAdd an activity to Mobile\u201d. Choose: \u201cAdd no activity\u201d.<\/figcaption><\/figure><\/p>\n<p>Now, our project has just been created!<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><span id=\"code\"><\/span><\/p>\n<h2>2. Create the layout and the source code of a simple AndroidStartServiceOnBoot Activity<\/h2>\n<p>Add a new Java class Activity inside <code>src\/com.javacodegeeks.androidserviceonbootexample\/<\/code> so that we are going to have the <code>src\/com.javacodegeeks.androidserviceonbootexample\/AndroidCustomFontExample.java<\/code> file and paste the code below.<\/p>\n<p><em><span style=\"text-decoration: underline\">MainActivity.java<\/span><\/em><\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.javacodegeeks.androidserviceonbootexample;\n\nimport android.app.Activity;\nimport android.os.Bundle;\n\npublic class MainActivity extends Activity {\n\n    public void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.main);\n    }\n}\n<\/pre>\n<p><em><span style=\"text-decoration: underline\">main.xml<\/span><\/em><\/p>\n<pre class=\"brush:xml; wrap-lines:false\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:gravity=\"center\"\n    android:orientation=\"vertical\"&gt;\n\n    &lt;TextView\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center\"\n        android:text=\"This Activity does nothing at all. But an auto-start service has just started!\"\n        android:textColor=\"#272727\"\n        android:textSize=\"20dp\" \/&gt;\n&lt;\/LinearLayout&gt;\n<\/pre>\n<p>Actually, this activity will not do anything concerning the service that starts on boot. All the logic regarding the service is explained in the next lines.<\/p>\n<h2>3. Creating the source code of the BroadcastReceiverOnBootComplete Service<\/h2>\n<p>Add a new Java class inside <code>src\/com.javacodegeeks.androidserviceonbootexample\/<\/code> so that we are going to have the <code>src\/com.javacodegeeks.androidserviceonbootexample\/BroadcastReceiverOnBootComplete.java<\/code> file and paste the code below.<\/p>\n<p><em><span style=\"text-decoration: underline\">BroadcastReceiverOnBootComplete.java<\/span><\/em><\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.javacodegeeks.androidserviceonbootexample;\n\nimport android.content.BroadcastReceiver;\nimport android.content.Context;\nimport android.content.Intent;\n\npublic class BroadcastReceiverOnBootComplete extends BroadcastReceiver {\n\n    @Override\n    public void onReceive(Context context, Intent intent) {\n        if (intent.getAction().equalsIgnoreCase(Intent.ACTION_BOOT_COMPLETED)) {\n            Intent serviceIntent = new Intent(context, AndroidServiceStartOnBoot.class);\n            context.startService(serviceIntent);\n        }\n    }\n}\n<\/pre>\n<p>We have just created a BroadcastReceiver that will receive the <strong><code>ACTION_BOOT_COMPLETED<\/code><\/strong> intent. This means that when we boot up our device this class will &#8220;catch&#8221; the event and start the <code>AndroidServiceStartOnBoot<\/code> service.<\/p>\n<h2>4. Creating the source code of the AndroidServiceStartOnBoot Service<\/h2>\n<p>Add a new Java class inside <code>src\/com.javacodegeeks.androidserviceonbootexample\/<\/code> so that we are going to have the <code>src\/com.javacodegeeks.androidserviceonbootexample\/AndroidServiceStartOnBoot.java<\/code> file and paste the code below.<\/p>\n<p><em><span style=\"text-decoration: underline\">AndroidServiceStartOnBoot.java<\/span><\/em><\/p>\n<pre class=\"brush:java; wrap-lines:false\">package com.javacodegeeks.androidserviceonbootexample;\n\nimport android.app.Service;\nimport android.content.Intent;\nimport android.os.IBinder;\n\npublic class AndroidServiceStartOnBoot extends Service {\n\n    @Override\n    public IBinder onBind(Intent intent) {\n        return null;\n    }\n\n    @Override\n    public void onCreate() {\n        super.onCreate();\n       \/\/ here you can add whatever you want this service to do\n    }\n\n}\n<\/pre>\n<h2>5. Editing the Android Manifest xml<\/h2>\n<p>The AndroidManifest.xml of our project is :[ulp id=&#8217;Ja8Orb5oPKdShcXt&#8217;]<\/p>\n<p><em><span style=\"text-decoration: underline\">AndroidManifest.xml<\/span><\/em><\/p>\n<pre class=\"brush:xml; wrap-lines:false,highlight:[5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,24]\">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;manifest xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    package=\"com.javacodegeeks.androidserviceonbootexample\"&gt;\n\n    &lt;uses-permission android:name=\"android.permission.RECEIVE_BOOT_COMPLETED\"&gt;&lt;\/uses-permission&gt;\n\n    &lt;receiver\n        android:name=\"com.javacodegeeks.androidserviceonbootexample.BroadcastReceiverOnBootComplete\"\n        android:enabled=\"true\"\n        android:exported=\"false\"&gt;\n        &lt;intent-filter&gt;\n            &lt;action android:name=\"android.intent.action.BOOT_COMPLETED\" \/&gt;\n        &lt;\/intent-filter&gt;\n        &lt;intent-filter&gt;\n            &lt;action android:name=\"android.intent.action.PACKAGE_REPLACED\" \/&gt;\n            &lt;data android:scheme=\"package\" \/&gt;\n        &lt;\/intent-filter&gt;\n        &lt;intent-filter&gt;\n            &lt;action android:name=\"android.intent.action.PACKAGE_ADDED\" \/&gt;\n            &lt;data android:scheme=\"package\" \/&gt;\n        &lt;\/intent-filter&gt;\n    &lt;\/receiver&gt;\n\n    &lt;service android:name=\"com.javacodegeeks.androidserviceonbootexample.AndroidServiceStartOnBoot\"&gt;&lt;\/service&gt;\n\n    &lt;application\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap\/ic_launcher\"\n        android:label=\"@string\/app_name\"\n        android:theme=\"@style\/AppTheme\"&gt;\n\n        &lt;activity\n            android:name=\"com.javacodegeeks.androidserviceonbootexample.MainActivity\"\n            android:label=\"@string\/app_name\"&gt;\n            &lt;intent-filter&gt;\n                &lt;action android:name=\"android.intent.action.MAIN\" \/&gt;\n                &lt;category android:name=\"android.intent.category.LAUNCHER\" \/&gt;\n            &lt;\/intent-filter&gt;\n        &lt;\/activity&gt;\n    &lt;\/application&gt;\n\n&lt;\/manifest\n&gt;\n<\/pre>\n<p>In this <code>AndroidManifest.xml<\/code> we register the application to listen to <code>android.intent.action.BOOT_COMPLETED<\/code>. Additionally, we register the <code>android.intent.action.PACKAGE_REPLACED<\/code> and the <code>android.intent.action.PACKAGE_ADDED<\/code> events. These events can catch the installation and update of our application, so that our service will start not only on device boot, but on application update.<\/p>\n<p>We also have to register our service in the <code>AndroidManifest.xml<\/code>. This happens at line 24.<\/p>\n<h2>6. Build, compile and run<\/h2>\n<p>When we build, compile and run our project, the main Android ServiceStart OnBoot application should look like this:<\/p>\n<p><figure id=\"attachment_33465\" aria-describedby=\"caption-attachment-33465\" style=\"width: 400px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostartscreens1.jpg\" rel=\"attachment wp-att-33465\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostartscreens1.jpg\" alt=\"This is this how our application should look like.\" width=\"400\" height=\"711\" class=\"size-full wp-image-33465\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostartscreens1.jpg 400w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostartscreens1-169x300.jpg 169w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><figcaption id=\"caption-attachment-33465\" class=\"wp-caption-text\">This is this how our application should look like.<\/figcaption><\/figure><\/p>\n<p>This application does not do anythining in its activity. All the work is done in the service that starts to run on the boot of our device, or on update of our application.<\/p>\n<p><figure id=\"attachment_33467\" aria-describedby=\"caption-attachment-33467\" style=\"width: 400px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostartscreens3.jpg\" rel=\"attachment wp-att-33467\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostartscreens3.jpg\" alt=\"This is the service that runs in our device.\" width=\"400\" height=\"711\" class=\"size-full wp-image-33467\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostartscreens3.jpg 400w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostartscreens3-169x300.jpg 169w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><figcaption id=\"caption-attachment-33467\" class=\"wp-caption-text\">This is the service that runs in our device.<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_33466\" aria-describedby=\"caption-attachment-33466\" style=\"width: 400px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostartscreens2.jpg\" rel=\"attachment wp-att-33466\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostartscreens2.jpg\" alt=\"This is the service that runs in our device.\" width=\"400\" height=\"711\" class=\"size-full wp-image-33466\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostartscreens2.jpg 400w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/androidautostartscreens2-169x300.jpg 169w\" sizes=\"(max-width: 400px) 100vw, 400px\" \/><\/a><figcaption id=\"caption-attachment-33466\" class=\"wp-caption-text\">This is the service that runs in our device.<\/figcaption><\/figure><\/p>\n<h2>7. Download the Android Studio Project<\/h2>\n<p>This was an example of Android AndroidServiceStartOnBoot.<\/p>\n<div class=\"download\"><strong>Download<br \/>\n<\/strong>You can download the full source code of this example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2016\/02\/AndroidStartServiceOnBootExample.zip\"><strong>AndroidStartServiceOnBootExample<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In the mobile device world, many times, we may need to make an application that has to do some tasks in the background, without the users to have to open their application. Some easy examples are the background Location tracking, or an alarm application, or the applications that want to receive push events from a &hellip;<\/p>\n","protected":false},"author":14,"featured_media":1202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[80],"tags":[1375,1376,1248],"class_list":["post-33254","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-activity","tag-android-auto-start-application","tag-android-development","tag-mobile-application"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android Start Service on Boot Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In the mobile device world, many times, we may need to make an application that has to do some tasks in the background, without the users to have to open\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Start Service on Boot Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In the mobile device world, many times, we may need to make an application that has to do some tasks in the background, without the users to have to open\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2016-02-08T13:00:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-04-24T12:56:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Chryssa Aliferi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Chryssa Aliferi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/\"},\"author\":{\"name\":\"Chryssa Aliferi\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332\"},\"headline\":\"Android Start Service on Boot Example\",\"datePublished\":\"2016-02-08T13:00:57+00:00\",\"dateModified\":\"2019-04-24T12:56:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/\"},\"wordCount\":685,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"keywords\":[\"android auto start application\",\"android development\",\"mobile application\"],\"articleSection\":[\"activity\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/\",\"name\":\"Android Start Service on Boot Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"datePublished\":\"2016-02-08T13:00:57+00:00\",\"dateModified\":\"2019-04-24T12:56:49+00:00\",\"description\":\"In the mobile device world, many times, we may need to make an application that has to do some tasks in the background, without the users to have to open\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"core\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"activity\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/activity\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Android Start Service on Boot Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332\",\"name\":\"Chryssa Aliferi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg\",\"caption\":\"Chryssa Aliferi\"},\"description\":\"Chryssa is a Computer Science graduate from Athens University of Economic and Business. During her studies, Chryssa carried out a great variety of projects ranging from networking to software engineering. She is very keen on front end development especially on mobile technologies and web applications. She has worked as a junior Software Engineer in the telecommunications area and currently works as an Android Developer.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\/\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/chryssa-aliferi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Start Service on Boot Example - Java Code Geeks","description":"In the mobile device world, many times, we may need to make an application that has to do some tasks in the background, without the users to have to open","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/","og_locale":"en_US","og_type":"article","og_title":"Android Start Service on Boot Example - Java Code Geeks","og_description":"In the mobile device world, many times, we may need to make an application that has to do some tasks in the background, without the users to have to open","og_url":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2016-02-08T13:00:57+00:00","article_modified_time":"2019-04-24T12:56:49+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","type":"image\/jpeg"}],"author":"Chryssa Aliferi","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Chryssa Aliferi","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/"},"author":{"name":"Chryssa Aliferi","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332"},"headline":"Android Start Service on Boot Example","datePublished":"2016-02-08T13:00:57+00:00","dateModified":"2019-04-24T12:56:49+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/"},"wordCount":685,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","keywords":["android auto start application","android development","mobile application"],"articleSection":["activity"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/","url":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/","name":"Android Start Service on Boot Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","datePublished":"2016-02-08T13:00:57+00:00","dateModified":"2019-04-24T12:56:49+00:00","description":"In the mobile device world, many times, we may need to make an application that has to do some tasks in the background, without the users to have to open","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/android-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/android\/core\/activity\/android-start-service-boot-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Android","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/"},{"@type":"ListItem","position":3,"name":"core","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/"},{"@type":"ListItem","position":4,"name":"activity","item":"https:\/\/examples.javacodegeeks.com\/category\/android\/core\/activity\/"},{"@type":"ListItem","position":5,"name":"Android Start Service on Boot Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/863144453b9fc15d4184d71833dcf332","name":"Chryssa Aliferi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/03\/Chryssa-Aliferi-96x96.jpg","caption":"Chryssa Aliferi"},"description":"Chryssa is a Computer Science graduate from Athens University of Economic and Business. During her studies, Chryssa carried out a great variety of projects ranging from networking to software engineering. She is very keen on front end development especially on mobile technologies and web applications. She has worked as a junior Software Engineer in the telecommunications area and currently works as an Android Developer.","sameAs":["http:\/\/www.javacodegeeks.com\/"],"url":"https:\/\/examples.javacodegeeks.com\/author\/chryssa-aliferi\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/33254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=33254"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/33254\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1202"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=33254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=33254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=33254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}