MCPcopy Create free account
hub / github.com/KAlO2/PerfectShow / App

Class App

src/com/cloudream/ishow/App.java:12–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10import android.util.Log;
11
12public class App extends android.app.Application
13{
14 private static final String TAG = App.class.getSimpleName();
15 public static final String PACKAGE_NAME = "com.cloudream.makeup";
16
17 private ArrayList<Activity> runningActivities;
18
19 @Override
20 public void onCreate()
21 {
22 super.onCreate();
23
24 if(BuildConfig.DEBUG)
25 {
26 final String package_name = getApplicationContext().getPackageName();
27 if(!PACKAGE_NAME.equals(package_name))
28 throw new SecurityException("Cached package name doesn't match with App's package name");
29 }
30
31 }
32
33 private String getVersion()
34 {
35 try
36 {
37 PackageManager pm = this.getPackageManager();
38 PackageInfo pi = pm.getPackageInfo(this.getPackageName(), PackageManager.GET_ACTIVITIES);
39 return pi.versionName;
40 }
41 catch(PackageManager.NameNotFoundException e)
42 {
43 e.printStackTrace();
44 }
45 return "1.0.0";
46 }
47
48 public static String getWorkingDirectory()
49 {
50 final File pictures = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
51 File file = new File(pictures, "PerfectShow");
52 if(!file.exists())
53 file.mkdir();
54 else if(file.isFile())
55 {
56 Log.w(TAG, file.getPath() + " is occupied");
57 return pictures.getPath();
58 }
59
60 return file.getPath();
61 }
62
63 public boolean isApplicationInstalled(String packageName)
64 {
65 try
66 {
67 PackageManager pm = this.getPackageManager();
68 pm.getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES);
69 return true;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected