I'm trying to start an Android Service on Boot that entails starting advertisements on boot which can be read by a BLE scanner. Do you know how to go about doing so? Currently, I keep getting "Unfortunately, 'myService' has stopped." Note: I am using Xamarin for Android development.
In order to do this you need to register a BroadcastReceiver for the system intent "android.intent.action.BOOT_COMPLETED" on your Android manifest. However, if your application is installed on the external storage use "android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE". From this BroacastReceiver you can then start your Service.
There's a nice tutorial here that should meet your needs. Also check this other SO question which has a detailed explanation on the subject.
Related
I have implement some libs and realize that there is an service running by my app (See it in apps manager of device settings, the service name is SyncService).
Please tell me how to find out what library started this service.
Thanks a lot!
My application contains a BOOT_COMPLETED receiver like described in other threads here. It works perfectly until I changed my app into a system application. Now the Receiver does not trigger the event anymore.
Any ideas for this issue? I'm using Android Kitkat 4.4.2 on a Radxa Rock Pro. Compiled my own image to register the app as system application.
we need more detail to help you, post the code and the manifest, also debug log, in other hand you must use Log.i(TAG, "onReceive."); to know if the problem is in onReceive() or when trying to run the service class.
I am trying to debug native code in my Android App development and I need to have com.android.server.PackageManagerServices in the device. I search the info for PackageManagerServices and can't find good info in the web.
My queries are
(1)Where to get com.android.server.PackageManagerServices?
(2)How to create this service available on the device?
Thanks
PackageManagerService is located at /frameworks/base/services/java/com/android/server/pm/
PackageManagerService is a system service which gets started by SystemServer.java at boot time and always keeps running. one need not to create another instance of it.
You can refer aosp source code at http://androidxref.com
I tried NFC demo with my nexus s and it works well.
I want to call an app from background to foreground using foregrounddispatch example given by android sdk. Can I test foregrounddispatch example with NFC demo? Does anyone who tried this?
and if possible, which part I should edit? It is my first time to manage android app so please give me advice.
(foregrounddispatch example: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/nfc/ForegroundDispatch.html )
Foreground dispatching requires the app to be in the foreground when scanning the tag. If I understand correctly, you want an app to launch upon scanning the tag. In this case, you need to create intent filters to handle the specific tag that you want to handle. See the dev guide for more information: http://developer.android.com/guide/topics/nfc/nfc.html or let me know if you need more guidance.
I have developed an android service. Any android app can use it's API's to get some kind of news updates from this service. I want to distribute this service so that any android app on the phone can use this service. My questions here are :
When some android application try to use its API on the phone and suppose that service is not available on the phone then what will happen ?
How will android application developer will make sure that the service is available on the phone ?
Does application developer has to bundle service with his application ? If yes then wont be there multiple instances of same service on phone if multiple application contains same service on the phone ?
Thanks
Dalvin
When some android application try to use its API on the phone and suppose that service is not available on the phone then what will happen?
If they are smart, they will use PackageManager to see if you are installed first. Otherwise, their attempt to call startService() or bindService() will fail.
How will android application developer will make sure that the service is available on the phone ?
Use PackageManager.
Does application developer has to bundle service with his application?
How are we supposed to know? You are the person who wrote it.
If yes then wont be there multiple instances of same service on phone if multiple application contains same service on the phone ?
Possibly. It is difficult to answer this question in the abstract, as there are multiple ways to distribute this service (as an APK, as an Android library project, as a JAR, as just a hunk of source code) and multiple ways to integrate it (change the source code, use the source/JAR/library as-is, reference the existing APK).