草庐IT

ddd-service

全部标签

android - Context.startForegroundService() 然后没有调用 Service.startForeground() 即使我停止了服务

所以我的应用程序有一些触发服务和通知的远程操作。在调用startForegroundService和服务尝试启动通知之间,事情可能会发生变化,因此服务会再次检查事情的状态,然后决定要做什么。因此,如果我的服务决定它不需要运行,它将调用:stopForeground(true);stopSelf();但出于某种原因,这似乎不起作用,因为我在发出这些调用后几乎立即得到了这个异常。11-1613:34:23.48815099-15099/mypackageE/AndroidRuntime:FATALEXCEPTION:mainProcess:mypackage,PID:15099androi

android - SERVICE_VERSION_UPDATE_REQUIRED 和 Google play 服务在 android 中集成 Google Plus 时已过时

我在Android应用程序中集成了GooglePlus。我使用的是AndroidSDK版本4.2.2。但是我在googleplus上执行分享帖子时遇到了这个错误:GooglePlusServiceOutofdate和ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED,resolution=null}我想在模拟器上运行GooglePlusPosting,而不是在设备上。我们将不胜感激。 最佳答案 我收到这个错误仅仅是因为GooglePlay服务在模拟器上运行时实际上已

android - 修订版 2 : How to pass data from a background Service/thread to some other activity than the MainActivity that created the background service

我创建了一个简单的Android应用程序,用于测试如何使用一个或多个处理程序将数据从后台服务/线程传递到创建后台服务的MainActivity以外的其他Activity。我在MainActivity中获得了服务、线程和处理程序。最后一步是让处理程序将数据传递给MainActivity以外的其他一些Activity。我可以让服务将消息传递给MainActivity的处理程序,但我不知道如何让它将数据传递给其他一些Activity。为什么会有人想要这样做?我认为这与一个简单的MP3播放器相比,但它实际上与一个不错的FMradio相比。MainActivity使用允许我选择FM电台的后台服务

Service 中的 Android ViewModel(备选)

我有一项服务可以提供大多数时间对用户可见的UI。当我遇到问题时,我正在尝试新的应用程序架构。MyModelviewModelviewModel=ViewModelProviders.of(this).get(MyModelviewModel.class);但如您所知,this只能是AppCompat或Fragment还有其他选择吗?或者我可以将观察者直接放在我的LiveData上,就像我放在ViewModel上一样viewModel.getList().observe(Playground.this,newObserver>(){@OverridepublicvoidonChanged

android - Android中是否有类似Apple Push Notification Service的推送通知服务?

我想为Android手机用户提供推送通知服务,Android中有没有类似ApplePushNotificationService的推送通知服务? 最佳答案 哦,是的!它叫做C2DM.请检查一下!编辑:Tutorial已添加链接!编辑:为了完整起见,C2DM现已弃用,取而代之的是GoogleCloudMessaging编辑:GCM现已被FirebaseCloudMessaging取代 关于android-Android中是否有类似ApplePushNotificationService的推

android - 从 Android 中的 Activity 启动服务时出现 "Unable to start service Intent"错误

当我尝试在“我的Activity”Activity上使用复选框来启动名为​​“MyService”的服务时,我在DDMS中看到以下错误:W/ActivityManager(73):UnabletostartserviceIntent{cmp=com.example.android.myprogram/.MyService}:notfound我使用了教程http://developer.android.com/resources/tutorials/views/hello-formstuff.html并将提供的代码添加到我的onCreate()方法的末尾。我在MyActivity.jav

android - 错误 : fix the version conflict (google-services plugin) using productFlavors

我知道存在版本冲突,但在Google推出新版本后问题仍然存在。Error:Executionfailedfortask':app:processCurrentDebugGoogleServices'.Pleasefixtheversionconflicteitherbyupdatingtheversionofthegoogle-servicesplugin(informationaboutthelatestversionisavailableathttps://bintray.com/android/android-tools/com.google.gms.google-service

android - 添加Google Play Services 9.0.0后Dex文件超过64k

我按照Firebase指南添加FCM,因此我将以下依赖项添加到我的应用程序gradle:compile'com.google.android.gms:play-services:9.0.0'applyplugin:'com.google.gms.google-services'这是我的项目gradle:classpath'com.google.gms:google-services:3.0.0'在此之后,我从Firebase控制台设置中添加了google-services.json,方法是下载它并将其添加到我的应用程序目录中。现在我收到这个错误:错误:.dex文件中方法引用的数量不能超

android - Xamarin 无法使用 : "Unexpected install output: cmd: Can' t find service: package"将应用程序部署到模拟器

我正在构建示例introxamarinformsapp使用VisualStudio2019和模拟器启动,但应用程序未部署并出现错误Unexpectedinstalloutput:cmd:Can'tfindservice:package":1>Nowaytoresolveconflictbetween"mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089"and"mscorlib,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7

android - 在 [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug] 中找不到 google-services.json

我遇到错误,无法完成构建。我搜索了Stackoverflow和Github。我已经尝试了很多方法,但我无法修复。请帮忙。(1)在[src/nullnull/debug,src/debug/nullnull,src/nullnull,src/debug,src/nullnullDebug](2)registerResGeneratingTask已弃用,请使用registerGeneratedResFolders(FileCollection)当我将google-services.json添加到app/src/debug和app/src/release时,(1)将消失。然后(2)仍然发出警