第三方app开启自己app需要的操作
来源:互联网 发布:c语言!=eof怎么用 编辑:程序博客网 时间:2024/05/16 15:17
第三方app:
open = (Button) findViewById(R.id.button);open.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { JSONObject json = new JSONObject(); try { json.put("loginflag", false);//此值必须为false json.put("ip", "192.168.0.91");//服务器地址 json.put("port", "6661");//服务器端口号 json.put("account", "wubj1");//用户账号 json.put("password", "123456");//用户密码 json.put("domain","domin");//域名 Intent service = new Intent("com.qim.basdk.service.BAMainService"); service.setPackage("com.qim.im"); service.putExtra("params", json.toString()); startService(service); } catch (JSONException e) { e.printStackTrace(); } SystemClock.sleep(1000); Intent intent = new Intent(); ComponentName cn = new ComponentName("com.qim.im", "com.qim.im.ui.view.BAMainActivity"); intent.setComponent(cn); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);我们的app:
mainferst里面设置:
<service android:name="com.qim.basdk.service.BAMainService" android:enabled="true" android:exported="true" > <intent-filter> <action android:name="com.qim.basdk.service.BAMainService" android:priority="1000" /> </intent-filter></service>mainService里面:
@Overridepublic int onStartCommand(Intent intent, int flags, int startId) { String params = intent.getStringExtra("params"); Log.i("abcd","onstartCommand获取到数据"+params); if (Build.VERSION.SDK_INT < 18) { startForeground(BAServiceWakeReceiver.WAKE_SERVICE_ID, new Notification());//API < 18 ,此方法能有效隐藏Notification上的图标 } else { Intent innerIntent = new Intent(this, BAWakeMainInnerService.class); startService(innerIntent); startForeground(BAServiceWakeReceiver.WAKE_SERVICE_ID, new Notification()); } return START_STICKY;}
阅读全文
0 0
- 第三方app开启自己app需要的操作
- 从第三方app返回自己的app
- 第三方app调起自己的app方法,app url schema
- 怎么在第三方应用中打开自己的APP
- ios调用第三方程序打开文件,以及第三方调用自己的APP打开文件
- ios调用第三方程序打开文件,以及第三方调用自己的APP打开文件
- ios调用第三方程序打开文件,以及第三方调用自己的APP打开文件
- 调用第三方APP
- 常用第三方APP 的url scheme
- 提高第三方app的service优先级
- APP使用的一些第三方库
- 根据app的名字启动第三方app
- 第三方jar或者aar使用的minsdkversion 小于自己app的version解决办法
- android 禁用和开启四大组件的方法(setComponentEnabledSetting )和打开第三方app的Launch Activity
- Android 仿照第三方app 将自己APP显示在打开列表中
- android_判断第三方app
- Android调用第三方App
- Android调用第三方App
- swift4.0 涂鸦画板
- 项目开发中STM32CUBEMX在使用时遇到的问题
- 485的A、B端电压是由什么决定的?
- GO语言的TCP小程序
- nsq源码分析(2):nsqlookup之启动和停止
- 第三方app开启自己app需要的操作
- CSS之元素视图属性
- utf8和gbk互转实现
- 好的编程状态
- Xcode8.2 真机测试 ,添加iOS10.3的idk到Xcode8.2中
- PHP学习笔记——超全局数组(预定义变量)
- JavaBean,EL表达式和JSTL的介绍
- Redis数据库--快速入门手册
- 守护进程理解与创建