-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDCryptService.java
More file actions
40 lines (31 loc) · 1.12 KB
/
DCryptService.java
File metadata and controls
40 lines (31 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.example.jay_pc.dcrypt;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
/**
* Created by Jay-pc on 3/10/2017.
*/
public class DCryptService extends Service {
@Override
public IBinder onBind(Intent intent) {
return null;
}
@SuppressWarnings("deprecation")
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Notification note = new Notification(R.drawable.db_icon, "Started DCrypt", System.currentTimeMillis());
Intent intent2 = new Intent(this, DCryptActivity.class);
intent2.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|
Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pi = PendingIntent.getActivity(this, 0, intent2, 0);
note.setLatestEventInfo(this, "DCrypt", "DCrypt running", pi);
startForeground(1337, note);
return super.onStartCommand(intent, flags, startId);
}
@Override
public void onDestroy() {
super.onDestroy();
}
}