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
Related
I want to write one script(.sh file) in the kernel which is continuously checking my System app.
if my system app is crashed or for any other reason it stopped. my script(.sh file) will start the application.
Anyone have this script example or any other method to do this?
in which location I have to add this script in the Android part?
Thanks.
Let me know if you give more details.
In Android, you should handle this on the framework level.
Specifically ActivityManagerService is the system service which deals with this. You should debug and find the specific logic that is triggered when app crashes, so that you can there trigger a re-open.
Having searched a bit on the AOSP code, this seems to be the relevant file:
https://android.googlesource.com/platform/frameworks/base/+/master/services/core/java/com/android/server/am/AppErrors.java
Just starting with android.
I try to create project that will send notification ( some bit for example ) to my FTP server every 3 hours.
I don't know how to create this project because each time i create new android project i must have only project with activity - and i don't need any activity - just need a service that will run when i install it on the device.
each time i create new android project i must have only project with activity
If you are using Eclipse, uncheck the "Create activity" checkbox that tells the new project wizard to create an activity.
If you are using android create project, yes, it will create an activity for you. You can delete the Java class and the manifest <activity> entry if you want.
In reality, you will wind up leaving all of it alone.
just need a service that will run when i install it on the device.
First, a service does not run just because you install it on the device. It only runs if you write code to cause it to run.
Second, while you might think "well, I will just get control at boot time and start the service then", that is possible, but it will not work on Android 3.1+ devices unless the user has run an activity first. This is to prevent "drive-by" malware.
So, I suggest that you leave the activity in there, if you want your app to work.
Moreover, unless this app is only for yourself, your users need the activity, to:
Control the behavior of the service, such as changing the "every 3 hours" setting to something they prefer
Read your license agreement
Read your documentation, including how to get support
Etc.
I have been trying to figure this out on the web with no information whatsoever as to what this actually does. The Google Manifest information says:
Allows an application to set the maximum number of (not needed) application processes that can be running.
I am thinking this is not a third party app permission but I need to be sure, its for our embedded device.
My guess is that this limits the number of processes that one application can have open when calling android:process=".RemoteActivity" in the manifest.
Anyone? Thank you.
It's a development/debug intended permisson. And just do what it says. Remember that when you run an app, android creates a process for all it's activities. This is, if you start opening the different activities of your application, you use the same process. However, Android let's you choose if an activity uses the main process or another new one. That's why this permission exists.
Sources:
http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html
http://developer.android.com/reference/android/Manifest.permission.html#SET_PROCESS_LIMIT
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).
I am new to android. I need to create an auto startup application. That application will control the files( if we open a image file from Gallery (or) mail attachments, on that time our application give a alert dialog to the user). Please guide to how to create an auto startup application to control all the file format in the android emulator.
You should use the permission android.permission.RECEIVE_BOOT_COMPLETED and register a BroadcastReceiver for android.intent.action.BOOT_COMPLETED.
Update:
I can't find a source, but I'm pretty sure, before an app is able to receive android.intent.action.BOOT_COMPLETED it should at least have been started once since it's installation.
You can take a look at Photostream source as it implements BroadcastReceiver approach suggested by MrSnowflake http://code.google.com/p/apps-for-android/
Please guide to how to create an auto
startup application to control all the
file format in the android emulator.
Creating an "auto startup application" can be done as MrSnowflake and Fedor describe.
Creating an "application to control all the file format in the android emulator", fortunately, is impossible, as that would represent a massive security hole.