Skip to content

Instantly share code, notes, and snippets.

@varunon9
varunon9 / AlwaysRunningAndroidService.md
Last active April 20, 2024 23:38
How to create an always running service in Android

Full Source Code: https://github.com/varunon9/DynamicWallpaper/tree/always_running_service

Steps-

  1. Create a Foreground Service (MyService.java)
  2. Create a Manifest registered Broadcast Receiver (MyReceiver.java) which will start your Foreground Service
  3. In onDestroy lifecycle of MyService, send a broadcast intent to MyReceiver
  4. Launch the MyService on app start from MainActivity (see step 8)
  5. With above 4 steps, MyService will always get re-started when killed as long as onDestroy of Service gets called
  6. onDestroy method of Service is not always guaranteed to be called and hence it might not get started again
@boeledi
boeledi / OverlayableContainerOnLongPress_sample.dart
Last active May 1, 2024 04:47
How to display an overlay on top of a particular item, present in a Scroll Area, on longPress?
import 'package:flutter/material.dart';
import 'dart:math';
void main() {
///
/// Launch the application
///
runApp(const Application());
}
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>