The Android startup used to schedule tasks, jobs while launching Android App.

Related tags

App AndroidStartup
Overview

Android Startup, schedule your startup jobs

License Version Code Grade Build Min Sdk Version Author QQ Group

Introduction

AndroidStartup is an open source project used to refine your Andriod App startup. Compared with Jetpack Startup, this project can used for ASYNC circumstance. As we konw, in most cases, to accelerate the App startup, we may run our jobs in background threads. You are allow to use background and main thread jobs and specify their dependencies in AndroidStarup. The AndroidStartup could handle their relations and run jobs by their dependencies.

Setup

Add MavenCentral,

repositories { mavenCentral() }

Add the dependency to use startup in your project,

implementation "com.github.Shouheng88:startup:$latest-version"

If you want to use the @StartupJob annotation to define the job, append the below dependenc,

kapt "com.github.Shouheng88:startup-compiler:$latest-version"

If you want just use the scheduler of startup, you can just use the scheduler by,

implementation "com.github.Shouheng88:scheduler:$latest-version"

Initialize at Android Startup

You have multiple ways to use AndroidStartup.

Implement ISchedulerJob to define your job

The ISchedulerJob interface is used to define the job in scheduler. You have to implement its three methods,

  • threadMode() to specify the thread job that the task will run
  • dependencies() dependeny jobs the current job relies on
  • run() the business for the job

Set up manifest entries

Android Startup includes a special content provider called AndroidStartupProvider that it uses to discover and call your scheduler jobs. Android Startup discovers jobs by first checking for a <meta-data> entry under the AndroidStartupProvider manifest entry.

<provider
   android:authorities="${applicationId}.androidx-startup"
   android:exported="false"
   tools:node="merge"
   android:name="me.shouheng.startup.AndroidStartupProvider">
   <meta-data android:name="me.shouheng.startupsample.jobs.BlockingBackgroundJob"
         android:value="android.startup" />
   <meta-data android:name="me.shouheng.startupsample.jobs.CrashHelperInitializeJob"
         android:value="android.startup" />
   <meta-data android:name="me.shouheng.startupsample.jobs.DependentBlockingBackgroundJob"
         android:value="android.startup" />
   <meta-data android:name="me.shouheng.startupsample.jobs.ThirdPartLibrariesInitializeJob"
         android:value="android.startup" />
</provider>

The tools:node="merge" attribute ensures that the manifest merger tool properly resolves any conflicting entries.

Manually initialize jobs

The Android Startup also allows you to initialize Startup by directly calling AndroidStartup builder. You can specify jobs by its jobs() method and then call launch() to start these jobs.

AndroidStartup.newInstance(this).jobs(
   CrashHelperInitializeJob(),
   ThirdPartLibrariesInitializeJob(),
   DependentBlockingBackgroundJob(),
   BlockingBackgroundJob()
).launch()

Use @StartupJob annotation to initialize jobs

You can alswo use @StartupJob to define jobs and then call scanAnnotations() method of AndroidStartup to scan jobs with @StartupJob annotation.

AndroidStartup.newInstance(this).scanAnnotations().launch()

To use the annotation driver you will have to add the kotlin-kapt plugin and the startup-compiler.

License

Copyright (c) 2021 ShouhengWang.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
My attempt at completing Advent of Code for the first time, might also learn Kotlin while doing so.

AdventOfCode2021 Welcome to the Advent of Code1 Kotlin project created by debskipawel using the Advent of Code Kotlin Template delivered by JetBrains.

jtx Board allows you to manage your Journals (like meeting minutes), Notes and Tasks in one Android app. The app is compatible with the iCal standard (RFC5545) and is integrated with DAVx5 to allow the synchronisation of entries through CalDAV. Taskify - An app to manage your daily tasks and boost your productivity. Taskify is built using kotlin and follows all modern android Development practices and hence is a good learning resource for beginners
Taskify - An app to manage your daily tasks and boost your productivity. Taskify is built using kotlin and follows all modern android Development practices and hence is a good learning resource for beginners

Taskify Taskify is an app to manage your daily tasks and boost your productivity Video Introduction 📹 This is a small introduction video about Taskif

AndroidEssentials is an android library that creates helper functions for performing common tasks in Android

AndroidEssentials is an android library that creates helper functions for performing common tasks in Android such as managing preferences, managing files, showing alerts, showing toasts, checking user country & checking network connection of users. All the methods of the class are static and should be accessed directly from the AndroidEssentials class.

The tasks provided in the perspective of Google's android training project

Dogglers - Starter Code Starter code for the second independent project for Android Basics in Kotlin. Introduction This is the starter code for the Do

Environmental-Monitoring-Android-App - This Android App is used to monitor environmental parameters data from remote sensors
Environmental-Monitoring-Android-App - This Android App is used to monitor environmental parameters data from remote sensors

Environmental-Monitoring-Android-App - This Android App is used to monitor environmental parameters data from remote sensors. Parameters includes but not limited to temperature, humidity, air quality, level of Ionizing radiation, ...

A sample app illustrating Android development using Kotlin with MVVM architecture, Android Jetpack, and other commonly used libraries.

Anime Facts A sample app illustrating Android development using Kotlin with MVVM architecture, Android Jetpack, and other commonly used libraries. Ani

An android & arduino project. The android app is used to control motors via Arduino.
An android & arduino project. The android app is used to control motors via Arduino.

Boccia ramp project An android & arduino project. The android app is used to control motors via Arduino. Description This project is made in the conte

Note-Taking-App - Android application which can be used to take notes
Note-Taking-App - Android application which can be used to take notes

Android application which can be used to take notes.The application uses Recycle

Owner
ShouHeng
.java.kt.py.fe
ShouHeng
An app that is a one-stop destination for all the CS enthusiasts, providing resources like Information scrapping techniques, best YT channels, courses available free-of-cost, etc. & knowledge about every domain and field that exists on the Internet related to Computer Science along with News, Jobs, and Internships opportunities in these domains along with valuable tips and hacks from mentors for a particular domain.

An app that is a one-stop destination for all the CS enthusiasts, providing resources like Information scrapping techniques, best YT channels, courses available free-of-cost, etc. & knowledge about every domain and field that exists on the Internet related to Computer Science along with News, Jobs, and Internships opportunities in these domains along with valuable tips and hacks from mentors for a particular domain.

CSwala 48 Nov 26, 2022
Small library that allows the application to display a small troubleshooting guide in case of repeated app startup crashes.

AppSalvager What is it? AppSalvager allows you to combat the issue of repeating crashes on app startup. Failed data migration, SDKs not handling their

Alexander Leontev 29 Aug 31, 2022
Instrumentation library for Android Cold Startup

This is an instrumentation library for Android Cold Startup which gives duration for each phase of App Startup.

OkCredit 39 Dec 26, 2022
Test android startup time fluctsdk

Test android startup time fluctsdk

Shuma Yoshioka 0 Feb 4, 2022
ToDo App is a kind of app that generally used to maintain our day-to-day tasks or list everything that we have to do

ToDo App is a kind of app that generally used to maintain our day-to-day tasks or list everything that we have to do, with the most important tasks at the top of the list, and the least important tasks at the bottom. It is helpful in planning our daily schedules.

Hamza Gamal 9 Oct 16, 2022
This app reminds people to take medicine according to their respective schedule.

Medicine Reminder App Reminds people for medicine. Objective In this busy and competitive world, it is very difficult for a person to remember each an

Naman Agarwal 4 Jun 3, 2021
PDFER - App demo that uses WorkManager API to download and schedule PDFs in the background

PDFER App demo that uses WorkManager API to download and schedule PDFs in the background Download PDF You can either download custom pdf files by plac

Ahmed Samir 4 Nov 22, 2022
A simple Android app to demonstrate the use of Hover SDK for M-PESA Send Money while offline. This SDK does not require an internet connection, it automates USSD sessions in the background of an android application.

HoverSDKDemo Hover SDK is an Android SDK that lets mobile developers to add money features to the applications. This SDK does not require an internet

Joel Kanyi 9 Dec 21, 2022
an android app to send private secret SMS while terrorist Islamic republic of Iran banned internet access in Iran.

Mahsa An android application which is designed to deliver safe and encrypted messages using SMS while Islamic republic of Iran banned Iranian people a

null 3 Sep 22, 2022
Android Application for a user’s favorite Movies, TV shows and Anime while keeping up to date with the latest releases.

Android Application for a user’s favorite Movies, TV shows and Anime while keeping up to date with the latest releases.

PEC ACM CSS 20 Dec 26, 2022