Skip to content

Instantly share code, notes, and snippets.

[Unit]
Description = Java Service
After network.target = MyService.service
[Service]
Type = forking
#!/bin/sh
SERVICE_NAME=MyService
PATH_TO_JAR=/usr/local/MyProject/MyJar.jar
PID_PATH_NAME=/tmp/MyService-pid
case $1 in
start)
echo "Starting $SERVICE_NAME ..."
if [ ! -f $PID_PATH_NAME ]; then
nohup java -jar $PATH_TO_JAR /tmp 2>> /dev/null >> /dev/null &
echo $! > $PID_PATH_NAME
@kundansviet
kundansviet / AndroidManifest.xml
Created January 26, 2017 16:22
manifes file for firebase cloud messaging
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cb.androidwarriorfcmdemo" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
@kundansviet
kundansviet / AndroidManifest.xml
Created January 26, 2017 16:16
manifest file for firebase cloud messaging
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cb.androidwarriorfcmdemo" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
@kundansviet
kundansviet / gist:36c40983ddaad8fc66d8ab55ba187929
Created January 26, 2017 16:16
manifest file for firebase cloud messaging
We couldn’t find that file to show.
@kundansviet
kundansviet / gist:95676bf20c4c089ea78f7ea7e1a907fe
Created January 26, 2017 16:15
manifest file for firebase cloud messaging
We couldn’t find that file to show.
@kundansviet
kundansviet / MyMessagingService.java
Created January 26, 2017 16:10
Class to show notification from firebase cloud messaging service
package com.cb.androidwarriorfcmdemo;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
@kundansviet
kundansviet / MyInstanceIdService.java
Created January 26, 2017 15:59
class to access registration token
package com.cb.androidwarriorfcmdemo;
import android.util.Log;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;
/**
* Created by kundan on 1/26/2017.
*/
@kundansviet
kundansviet / ListAdapter.java
Last active August 11, 2018 13:05
Recyclerview with checkbox
package com.cb.recyclerwithcheckbox;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import java.util.HashMap;
@kundansviet
kundansviet / MainActivity.java
Last active January 14, 2017 09:07
Recyclerview with checkbox
package com.cb.recyclerwithcheckbox;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import java.util.ArrayList;