how to create startup application in android? - android

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.

Related

Create Service in Kernel Which is Monitoring Multiple Packages on Android

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

com.android.server.PackageManagerServices and Android

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

Android protocol handler not recognized by NFC

In my app, I have created a protocol handler for myapp://. This works perfectly. However, the NFC system does not seem to "recognize" it. When I create an NFC tag with the URI "myapp://test", instead of directly passing it to my app, the dialog "Choose an action" appears. I can then chose "New tag collected", select "myapp://test" and my application is started.
Is there anything I need to do additionally so that NFC directly opens my app?
You probably forgot to add the action "NDEF_DISCOVERED" to the intent filter in the Android manifest file.
You can solve this issue by adding an additional AAR record (special NDEF record = Android Application Record) to your tag. Subsequently, only your app is starting and nobody is asking anymore.
There are several apps available which create this android-applicationrecord for you.

How to create service project without any activity?

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.

What is android.permission.SET_PROCESS_LIMIT used for in an android application?

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

Categories

Resources