How to create a system app for custom ROM - android

We have a custom ROM for a device we are making and what I want to do is make our own custom Settings app to replace the settings app that comes already built in android.
I cant really find any documentation on how to even create a system app. It does not appear you can create it in Android Studio, I tried looking on the AOSP site and didnt find anything there related to creating system apps. The few things I did find were on here where you would put android:sharedUserId="android.uid.system" in your manifest and then has to be signed with the same key as the ROM but after that I cant find anything.
The settings app I want to create would need access to the framework.jar to be able to use the hidden framework API's.
Does anyone have any information or know where I can find this information on how to go about actually creating a system app?

You may want to research how to make a Device Tree Overlay (dto). Basically it is your code, reformatting the base code, into what you want. https://source.android.com/devices/architecture/dto?hl=en

Since you said you use Gradle, you should put first build you apk and put them in you vender folder, and next important thing is to create a mk/bp file to tell the Android build system how to deal with this pre-built apk.
P.S. If you system app highly depends on Android hidden api, make sure you have the right version of framework.jar in you Android Studio project, or, as what I alway did, create apps directly in AOSP, in this case, you can just check the code structure of the original Settings app in AOSP
this tutorial may help you.

Related

Xamarin.Forms (UWP and Android) directory selection outside of AppData

I've been pulling my hair out all day. I'm converting my WPF app to Xamarin.Forms (UWP, IOS and Android). I'm currently focused on UWP and Android (don't have an apple devices yet) and I got a lot of the program running but I ran into a huge snag with reading files that are not in my sandbox directory. Currently, my app allows you to choose a folder with images and you can move through them. To test out the reading functionality, I've placed the images into the "LocalState" directory and bingo, my code is working beautifully. Now the program doesn't have a default folder and when I originally created it in WPF, the user would have a pop up and they would choose their own folder but I cannot for the life of me get a similar function for Xamarin. Every time I try something, I get an "access denied". I've seen Android apps allow you to pick a folder for emulators and I'm 100% sure that you can setup UWP to do permissions with StorageApplicationPermissions but I just cannot get this to work for Xamarin.Forms. Please help me!
OK, Android first it is easier. You need to setup in the manifest permissions to read and write SD-card. On Marshmallow and later you need to ask for the permission at the runtime (you need to do that from the native project).
On UWP the easiest thing to do would be to set the broadfileaccess in the manifest. Other than that you pointed out to the proper APIs, just you need to run them natively.
In general native code is called by using dependency injection. If it gets too complicated you may consider to create Xamarin.Forms project as a shared project where you can use conditional compiling instead of dependency injection which is quite simpler.

Custom Android MMS/SMS application from source code?

Okay here's the deal:
I want to download the full source of the MMS/SMS application that ships with Android phones. I want to be able to modify it, and add a little custom functionality to it.
I am developing using Eclipse, and I'm on Windows 7. I have noticed that there is now a Git for Windows, but I am pretty lost in it and not sure how to integrate everything with Eclipse.
Basically, I want to just get it to the point where I have all the source code visible in Eclipse and be able to see the app run JUST like the built-in texting/MMS app that is already on my phone. Then I'll know that I can modify it and proceed.
Any ideas?
Thanks!
There's a mirror of the SMS/MMS app on GitHub here. Just import that to Eclipse and customise away.
Unless you want to customize and use it only on your own phone (without publishing), this is not a good idea. This is because it uses classes that are hidden from the sdk. By default you won't even be able to build the apk via eclipse, but there is a way. The reason why this is a bad idea is that the hidden apis are not guaranteed to remain the same through different api-levels and your app can stop working with the next android update, and might also not work on previous api-levels. In-fact your app might not even work on selected phones running the same api-level.

Can we change Android source code using Android NDK..?

I am having a requirement like to add a custom setting to android native settings(like when we go to Home->settings->Display we have Screen timeout,Animation,Auto-rotate screen,Brightness settings available.But i want to add one more setting like auto-screentimeout there.i,e i need to change the source code of android..some thing related to forked android consept)so,Is this possible..?if so can we use NDK for this...
Thanks in advance...
You can download the Android source code and then create your own settings APK. However it will probably only run on the phone you are testing it, and I assume you run into problems when using different Android versions or some modifications by device manufacturers.
Read more http://source.android.com/ on how to get started.
Alternatively you could extract the settings APK from your current phone, decompile it with apktools, and then re-create it again with your changes.
Read more on http://code.google.com/p/android-apktool/
In both ways you need to have root access to install the new APK... and probably a custom recovery to restore from a nandroid backup when your modification crashes!
The Android NDK is for writing application code in C or C++.
What you want is to build your own version of the Android firmware; it is a completely separate issue. Have a look at this for starters.

Replace a system application with your own modified application on android

I downloaded the source code of OI Notepad and did some modifications to it. And then made an .apk file out of it. But when I try to install the .apk it shows
This is a system application.
Do you still want to replace it?
When i say yes it moves forward but does not install it..
I have this post My application tries replace another my application and the answer given there the package name of both the apps cannot be same.
But is there any way in which I can manage to install modified OI Notepad without any hassles of replacing the older one. It happens in Emulator..
Thanks
If you are using eclipse you can right click the package tree and use the refactor option to quickly change the package. This, in most cases, correctly updates the Application Manifest for you. This 'should' resolve the error you are having keeping in mind that you will now have two versions of the application so it may be in your best interest to change the application name of your custom version so you can easily distinguish between the two.

how to setup details about an android app?

i have used eclipse, android sdk and phonegap to create a small application. I give it a test and create a test.apk package.
What i ma wondering is where can i set up some details about this app, like who made it, the app name, the version, an icon maybe, any other things i might need to setup.
I have a AndroidManifest.xml file and when i open it i get a nice gui but i don't know what to modify there
Im not sure what i need to set up and even if i need to.
A good tutorial is much appreciated. Thanks
You can set most of those things in the manifest file. If you want to include this information in your code, add license headers in all your classes, use java-doc etc.
If you want this information to be accessible in your app like from 'About' button, you have to handle it yourself.
Take a look at this example.
This details are to be filled when you upload it to android market. I dont think you set them in AndroidManifest.xml ! you can see the xml code , by clicking on the "source code" tab just below the UI .
Here's a tutorial that describes managing AndroidManifest.xml, the app name and icons from our AppLaud Eclipse plugin for PhoneGap Android.

Categories

Resources