Esempio n. 1
0
 public void startTestService() {
   startService(new Intent(this, TestService.class));
   Intent aaaa = new Intent();
   int androidVersion = ServiceUtils.getSDKVersionNumber();
   if (androidVersion >= 21) {
     // 只一句至关重要,对于android5.0以上,所以minSdkVersion最好小于21;
     aaaa.setPackage(getPackageName());
   }
   aaaa.setAction("common.het.com.library.intent.action.TestService");
   boolean mIsBound = bindService(aaaa, conn, Context.BIND_AUTO_CREATE);
   if (!mIsBound) {
     Logc.e("初始化service失败..mService=" + " mConnection=" + conn);
   } else {
     Logc.i(
         "成功初始化ServiceManager App.packageName="
             + getPackageName()
             + " mService="
             + " mConnection="
             + conn);
   }
 }
Esempio n. 2
0
 public void onServiceConnected(ComponentName name, IBinder service) {
   Logc.i("======================================================onServiceConnected===");
 }
Esempio n. 3
0
 public void onServiceDisconnected(ComponentName name) {
   Logc.i(
       "===========================================================onServiceDisconnected===");
 }