This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mod hello; | |
pub const FUNCTIONS: &[&azure_functions::codegen::Function] = azure_functions::export!{ | |
hello::hello, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: dart | |
dart: | |
- stable | |
os: | |
- linux | |
sudo: false | |
addons: | |
apt: | |
sources: | |
- ubuntu-toolchain-r-test # you need this source to get the right version of libstdc++6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
mkdir -p .pub-cache | |
cat <<EOF > ~/.pub-cache/credentials.json | |
{ | |
"accessToken":"$accessToken", | |
"refreshToken":"$refreshToken", | |
"tokenEndpoint":"$tokenEndpoint", | |
"scopes":["https://www.googleapis.com/auth/plus.me","https://www.googleapis.com/auth/userinfo.email"], | |
"expiration":$expiration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
implementation fileTree(dir: 'libs', include: ['*.jar']) | |
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | |
implementation 'com.android.support:appcompat-v7:28.0.0' | |
implementation 'com.android.support.constraint:constraint-layout:1.1.3' | |
implementation 'com.jaredrummler:android-device-names:1.1.8' | |
implementation 'com.github.kittinunf.fuel:fuel:2.1.0' | |
implementation 'com.github.kittinunf.fuel:fuel-android:2.1.0' | |
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0-M1' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EndlessService : Service() { | |
private var wakeLock: PowerManager.WakeLock? = null | |
private var isServiceStarted = false | |
override fun onBind(intent: Intent): IBinder? { | |
log("Some component want to bind with the service") | |
// We don't provide binding, so return null | |
return null | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.robertohuertas.endless"> | |
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"></uses-permission> | |
<uses-permission android:name="android.permission.INTERNET"></uses-permission> | |
<uses-permission android:name="android.permission.WAKE_LOCK" /> | |
<application | |
android:allowBackup="true" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
title = "Endless Service" | |
findViewById<Button>(R.id.btnStartService).let { | |
it.setOnClickListener { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb root | |
# If you get an error then you're not running the proper emulator. | |
# Be sure to stop the service | |
# and force a system restart: | |
adb shell stop | |
adb shell start | |
# wait for the service to be restarted! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StartReceiver : BroadcastReceiver() { | |
override fun onReceive(context: Context, intent: Intent) { | |
if (intent.action == Intent.ACTION_BOOT_COMPLETED && getServiceState(context) == ServiceState.STARTED) { | |
Intent(context, EndlessService::class.java).also { | |
it.action = Actions.START.name | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | |
log("Starting the service in >=26 Mode from a BroadcastReceiver") | |
context.startForegroundService(it) | |
return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.robertohuertas.endless"> | |
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"></uses-permission> | |
<uses-permission android:name="android.permission.INTERNET"></uses-permission> | |
<uses-permission android:name="android.permission.WAKE_LOCK" /> | |
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> | |
<application | |
android:allowBackup="true" |