Commit 4a19cc29 authored by mengcuiguang's avatar mengcuiguang

添加安装apk监听

parent d7913e62
......@@ -363,6 +363,8 @@
android:resource="@xml/wn_file_paths" />
</provider>
<service android:name=".service.MyService"></service>
</application>
</manifest>
\ No newline at end of file
package com.mints.goodmoney.service;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.IBinder;
import android.util.Log;
import android.widget.Toast;
import com.mints.goodmoney.utils.ToastUtil;
public class MyService extends Service {
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
public void onReceive(Context param1Context, Intent param1Intent) {
if (param1Intent == null)
return;
ToastUtil.show(param1Context.getApplicationContext(), param1Intent.getData().toString());
}
};
private void initReceiver() {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.PACKAGE_ADDED");
// intentFilter.addAction("android.intent.action.PACKAGE_REPLACED");
// intentFilter.addAction("android.intent.action.PACKAGE_REMOVED");
intentFilter.addDataScheme("package");
registerReceiver(this.broadcastReceiver, intentFilter);
}
public IBinder onBind(Intent paramIntent) {
return null;
}
public void onCreate() {
super.onCreate();
initReceiver();
}
public void onDestroy() {
super.onDestroy();
unregisterReceiver(this.broadcastReceiver);
}
public int onStartCommand(Intent paramIntent, int paramInt1, int paramInt2) {
Log.e("aaa", "22222222222");
return super.onStartCommand(paramIntent, paramInt1, paramInt2);
}
}
package com.mints.goodmoney.ui.activitys
import android.content.Context
import android.content.Intent
import android.media.AudioManager
import android.os.Bundle
import android.view.KeyEvent
......@@ -9,6 +10,7 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import com.ireader.ireadersdk.IreaderApi
import com.mints.goodmoney.InitAppService
import com.mints.goodmoney.R
import com.mints.goodmoney.ad.vedio.VedioAdingManager
import com.mints.goodmoney.common.AppConfig
......@@ -16,6 +18,7 @@ import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import com.mints.goodmoney.manager.ZhangyueManager
import com.mints.goodmoney.mvp.views.MainView
import com.mints.goodmoney.service.MyService
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.fragment.*
import kotlinx.android.synthetic.main.activity_main.*
......@@ -62,6 +65,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
tab_rl_channel.setOnClickListener(this)
tab_rl_friends.setOnClickListener(this)
tab_rl_my.setOnClickListener(this)
startService(Intent(context, MyService::class.java))
}
override fun isApplyKitKatTranslucency() = false
......
......@@ -198,7 +198,7 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
if (liebaoGameFragment == null) {
liebaoGameFragment = LiebaoGameFragment()
}
addOrShowFragment(childFragmentManager, kuYinyueFragment!!, FRAGMENT_TAG_GAME)
addOrShowFragment(childFragmentManager, liebaoGameFragment!!, FRAGMENT_TAG_GAME)
}
// 3 -> {
// if (kuYinyueFragment == null) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment