首页 文章 精选 留言 我的

精选列表

搜索[Windows应用SDK],共10000篇文章
优秀的个人博客,低调大师

一种提高Android应用进程存活率新方法(下)

接上文 创建 Account服务 publicclassXXAuthServiceextendsService{ privateXXAuthenticatormAuthenticator; @Override publicvoidonCreate(){ mAuthenticator=newXXAuthenticator(this); } privateXXAuthenticatorgetAuthenticator(){ if(mAuthenticator==null) mAuthenticator=newXXAuthenticator(this); returnmAuthenticator; } @Override publicIBinderonBind(Intentintent){ returngetAuthenticator().getIBinder(); } classXXAuthenticatorextendsAbstractAccountAuthenticator{ privatefinalContextcontext; privateAccountManageraccountManager; publicXXAuthenticator(Contextcontext){ super(context); this.context=context; accountManager=AccountManager.get(context); } @Override publicBundleaddAccount(AccountAuthenticatorResponseresponse,StringaccountType,StringauthTokenType,String[]requiredFeatures,Bundleoptions) throwsNetworkErrorException{ //添加账号示例代码 finalBundlebundle=newBundle(); finalIntentintent=newIntent(context,AuthActivity.class); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,response); bundle.putParcelable(AccountManager.KEY_INTENT,intent); returnbundle; } @Override publicBundlegetAuthToken(AccountAuthenticatorResponseresponse,Accountaccount,StringauthTokenType,Bundleoptions) throwsNetworkErrorException{ //认证示例代码 StringauthToken=accountManager.peekAuthToken(account,getString(R.string.account_token_type)); //ifnot,mightbeexpired,registeragain if(TextUtils.isEmpty(authToken)){ finalStringpassword=accountManager.getPassword(account); if(password!=null){ //getnewtoken authToken=account.name+password; } } //withoutpassword,needtosignagain finalBundlebundle=newBundle(); if(!TextUtils.isEmpty(authToken)){ bundle.putString(AccountManager.KEY_ACCOUNT_NAME,account.name); bundle.putString(AccountManager.KEY_ACCOUNT_TYPE,account.type); bundle.putString(AccountManager.KEY_AUTHTOKEN,authToken); returnbundle; } //noaccountdataatall,needtodoasign finalIntentintent=newIntent(context,AuthActivity.class); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,response); intent.putExtra(AuthActivity.ARG_ACCOUNT_NAME,account.name); bundle.putParcelable(AccountManager.KEY_INTENT,intent); returnbundle; } @Override publicStringgetAuthTokenLabel(StringauthTokenType){ //thrownewUnsupportedOperationException(); returnnull; } @Override publicBundleeditProperties(AccountAuthenticatorResponseresponse,StringaccountType){ returnnull; } @Override publicBundleconfirmCredentials(AccountAuthenticatorResponseresponse,Accountaccount,Bundleoptions) throwsNetworkErrorException{ returnnull; } @Override publicBundleupdateCredentials(AccountAuthenticatorResponseresponse,Accountaccount,StringauthTokenType,Bundleoptions) throwsNetworkErrorException{ returnnull; } @Override publicBundlehasFeatures(AccountAuthenticatorResponseresponse,Accountaccount,String[]features) throwsNetworkErrorException{ returnnull; } } } 声明Account服务 <service android:name="**.XXAuthService" android:exported="true" android:process=":core"> <intent-filter> <action android:name="android.accounts.AccountAuthenticator"/> </intent-filter> <meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator"/> </service> 其中authenticator为: <?xmlversion="1.0"encoding="utf-8"?> <account-authenticatorxmlns:android="http://schemas.android.com/apk/res/android" android:accountType="@string/account_auth_type" android:icon="@drawable/icon" android:smallIcon="@drawable/icon" android:label="@string/app_name" /> 使用Account服务 同SyncAdapter,通过AccountManager使用 。申请Token主要是通过 AccountManager.getAuthToken)系列方法 。添加账号则通过 AccountManager.addAccount) 。查看是否存在账号通过 AccountManager.getAccountsByType) Refs 微信Android客户端后台保活经验分享 Android Low Memory Killer原理 stackOverflow 上介绍的双Service方法 Write your own Android Sync Adapter Write your own Android Authenticator Android developer android.accounts AccountManager AbstractAccountAuthenticator AccountAuthenticatorActivity Creating a Sync Adapter Android篇从底层实现让进程不被杀死(失效Closed) Android 4.3+ NotificationListenerService 的使用 Going multiprocess on Android 本文作者:佚名 来源:51CTO

优秀的个人博客,低调大师

共享单车物联网应用重心从智能锁转移到电子围栏

在短短的一年多的时间里, 城市的大街小巷已经被橙、黄、绿、蓝、白、金、彩等各色共享单车所攻占,今年4月份开始,物联网“电子围栏”开始成为共享单车界的新话题,各地政府部门喜闻乐见,甚至单车品牌是否具有电子围栏成为某些地区的准入门槛。以摩拜、OfO为首的共享单车龙头开始进入到刷技术的阶段.共享单车电子围栏简单来说,“电子围栏”就是一个个虚拟的停车框,用户必须将车辆停在指定的停车框中,否则无法锁车结束行程。具体而言,通过物联网芯片发射信号覆盖技术,给共享单车停放划定一个区域,让单车只能停放在规定范围内。当车辆停放超出系统规定的区域时,系统会发出语音提示,要求骑行者将车辆返回至指定区域,否则车辆将无法上锁,后台也将会一直计费。 共享单车电子围栏的两种形式,一种是由政府统一规划的“公共电子围栏”,另一种是有共享单车企业自行设置的独立电子围栏,但在实际落地过程中,两种电子围栏也有重合的可能,例如OfO和北京经信委联合开发出了全国首个电子围栏技术,并在北京通州试点。两种电子围栏设置目的都在于限制停车位置,共享单车通过一定的定位技术识别用户是否将车停放在指定区域内,从而对用户进行奖励或惩罚。 共享单车实行的电子围栏主要有两种,一种是通过在地面建立信号发射装置来实现对停车区域的识别,有基于短距离无线通信技术而实现的,也有基于蓝牙实现的(如摩拜、小鸣单车);另一种是北斗导航提出的基于卫星定位技术的电子围栏系统(OfO),借助地面增强系统,北斗系统的定位精度可以达到亚米级,完胜GPS!高定位精度除了解决找车难问题,对于监管问题也是一把利器。 我们可以看到除了共享单车相关企业在积极推动之外,地方政府也参与了进来。共享单车已经由于过渡的铺设带来了明显的城市管理隐患,是时候到了政府介入携手共同规范化的阶段。深圳北航物联网研究院(www.buaaiot.org)相关人员认为通过“电子围栏”来规范化停车,是目前从技术角度来讲较为可行的约束手段,不过这会不会成为另一种形式的“定点桩”,还得看用户怎么想。

优秀的个人博客,低调大师

智能副驾是搜狗在 AI 落地应用上的全新探索

AI 热潮袭来,受到了各大企业和资本方的追逐,而很多移动互联网企业也大都一头扎进这个领域,欲成为这场技术革新的引领者,或至少成为早期参与者。 不过,从目前的情况来看,放眼整个 AI 领域,跟随者甚众,但落地产品寥寥。而作为率先入局者之一的搜狗,不同于其他巨头们企业争相布局通用型 AI 平台的思路,而是基于其在 AI 领域的天然优势,选择深挖垂直领域做功能型人工智能。 7 月 18 日,搜狗地图智能副驾这款产品推出,这是搜狗通过整合自身资源在人工智能落地上一个全新方向的探索,其中的隐含意味是:这只是一个开端,搜狗地图未来还将承载更多 AI 落地的方向。「毫无疑问,地图是非常好的承载平台。」搜狗地图总经理孔祥来告诉雷锋网(公众号:雷锋网)。 这款智能副驾产品支持用户全程进行语音交互,一定程度上解放了驾驶员的手和眼,给用户带来更智能、安全和便

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册
修改密码
忘记密码