Want to add activity in Settings.apk file - Android Q&A, Help & Troubleshooting

I want to add activity in Settings.apk, for that I have created Activity in below path
/home/amit/android/lineage/packages/apps/Settings/src/com/android/settings/network
I have declared AirplaneModePreference activity in AndroidManifest.xml like below
Code:
<activity android:name="com.android.settings.network.AirplaneModePreference"
android:taskAffinity="com.android.settings"
android:configChanges="orientation|keyboardHidden|screenSize"
android:parentActivityName="Settings"
android:label="Advance Airplane Mode">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
But still, when I start the AirplaneModePreference activity, I am getting following error
Code:
Process: com.android.settings, PID: 24946
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.settings.network/com.android.settings.network.AirplaneModePreference}; have you declared this activity in your AndroidManifest.xml (which is in Settings/AndroidManifest.xml) ?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2005)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1673)
at android.app.Activity.startActivityForResult(Activity.java:4587)
at android.app.Activity.startActivityForResult(Activity.java:4545)
at android.app.Activity.startActivity(Activity.java:4906)
at android.app.Activity.startActivity(Activity.java:4874)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:379)
at android.support.v7.preference.Preference.performClick(Preference.java:1139)
at com.android.settingslib.RestrictedPreference.performClick(RestrictedPreference.java:78)
at android.support.v7.preference.Preference.performClick(Preference.java:1107)
at android.support.v7.preference.Preference$1.onClick(Preference.java:172)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25906)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6729)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Do you have any idea, then please let me know, thanks a lot in advance

Related

No Launcher activity found!

I'm not a developer but I want to debug an Android app on my Droid. I have Eclipse installed, etc.
I am stuck now because I don't know how to define a launcher activity. Here are the console messages:
Code:
[2010-01-17 11:33:36 - TestApp]Android Launch!
[2010-01-17 11:33:36 - TestApp]adb is running normally.
[2010-01-17 11:33:36 - TestApp]No Launcher activity found!
[2010-01-17 11:33:36 - TestApp]The launch will only sync the application package on the device!
[2010-01-17 11:33:36 - TestApp]Performing sync
[2010-01-17 11:33:36 - TestApp]Automatic Target Mode: using device '04036_my_droid_09834'
[2010-01-17 11:33:36 - TestApp]Application already deployed. No need to reinstall.
[2010-01-17 11:33:36 - TestApp]/TestApp/bin/TestApp.apk installed on device
[2010-01-17 11:33:36 - TestApp]Done!
Where can I find some help for this? Thanks.
The launcher activity is defined in the AndroidManifest.XML file.
It is defined as:
<activity android:name=".ActivityName">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Hope that helps! I had to dig around a while to find this information too...but my app now runs properly.
I'm having ENDLESS issues getting my app to run...
I'm following this tutorial but even adding your code, it still crashes when installing and opening the app on my device....
PLEASE HELP
Here is y AndroidManifest:
Code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myfirstapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="21" android:maxSdkVersion="19"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

[DEV] Low Level System functions - permission problems

Hi
I'm trying to write an application that puts my device into sleep since my powerbutton is broken. (Thanks no option to return etc.)
Now when i try to tell my phone to go to sleep using:
Code:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
pm.goToSleep(0);
I'm getting the below error. How can I make it work?
I was told I need to sign the app with the rom key to use such low level system functionality. How can I do that, where can I get the key?
Is this possible for stock rom, CM6?
Thanks for you help
Code:
I/ActivityManager( 111): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.myapp.sl33p/.sl33p }
W/ActivityManager( 111): Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.myapp.sl33p/.sl33p } from ProcessRecord{4415
cd90 14332:android.process.acore/10068} (pid=14332, uid=10068) requires android.permission.DEVICE_POWER
E/Launcher(14332): Launcher does not have the permission to launch Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.myapp.sl33p/.sl33p }. Make sure
to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity.
E/Launcher(14332): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.myapp.sl33p/.sl33p } f
rom ProcessRecord{4415cd90 14332:android.process.acore/10068} (pid=14332, uid=10068) requires android.permission.DEVICE_POWER
E/Launcher(14332): at android.os.Parcel.readException(Parcel.java:1247)
E/Launcher(14332): at android.os.Parcel.readException(Parcel.java:1235)
E/Launcher(14332): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1298)
E/Launcher(14332): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1373)
E/Launcher(14332): at android.app.Activity.startActivityForResult(Activity.java:2817)
E/Launcher(14332): at com.fede.launcher.Launcher.startActivityForResult(Launcher.java:2783)
E/Launcher(14332): at android.app.Activity.startActivity(Activity.java:2923)
E/Launcher(14332): at com.fede.launcher.Launcher.startActivity(Launcher.java:3751)
E/Launcher(14332): at com.fede.launcher.Launcher.startActivitySafely(Launcher.java:3736)
E/Launcher(14332): at com.fede.launcher.AllAppsGridView.onItemClick(AllAppsGridView.java:1096)
E/Launcher(14332): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
E/Launcher(14332): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
E/Launcher(14332): at android.os.Handler.handleCallback(Handler.java:587)
E/Launcher(14332): at android.os.Handler.dispatchMessage(Handler.java:92)
E/Launcher(14332): at android.os.Looper.loop(Looper.java:123)
E/Launcher(14332): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/Launcher(14332): at java.lang.reflect.Method.invokeNative(Native Method)
E/Launcher(14332): at java.lang.reflect.Method.invoke(Method.java:521)
E/Launcher(14332): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/Launcher(14332): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/Launcher(14332): at dalvik.system.NativeStart.main(Native Method)
i was wondering the same, since my power button is dead, but was told by some devs that the system wont allow apps to put system into a sleep state.
the error says it all: android.permission.DEVICE_POWER
put this permission in your manifest and it should be fine.
Adding the permission isn't enough in this case, I think.
Isn't this permission granted to the system only ?
If it is, you'll need to sign the application with the CyanogenMod SDK key.
And it'll work only on CM.
Zappletoo said:
Adding the permission isn't enough in this case, I think.
Isn't this permission granted to the system only ?
If it is, you'll need to sign the application with the CyanogenMod SDK key.
And it'll work only on CM.
Click to expand...
Click to collapse
Yes that's exactly what I think and have been told. Can you give me a hint where I find this key and how I have to sign the app?
The only thing I could find is here:
http://wiki.cyanogenmod.com/index.php?title=How_to_build_a_kernel_port_for_CM6
but that's related to kernel and zip signing?
Thx
PS: And just for the records the manifest
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp.sl33p"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:permission="android.permission.DEVICE_POWER">
<activity android:name=".sl33p"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="1" />
<uses-permission android:name="android.permission.DEVICE_POWER" />
</manifest>
<uses-permission android:name="android.permission.DEVICE_POWER" />
well, the other choice perhaps is to compile your app with the Android ROM tree.

[Q] what is “BasicDream” in android ICS?

I read the Launcher source code which version is ICS. There is a RocketLauncher class which extends BasicDream. what is BasicDream? what can BasicDream do? I can find this line import android.support.v13.dreams.BasicDream;, but I can't find any information about it on Internet. Please give me some information to understand it. Thanks!
I found those code in launcher manifest.xml <activity android:name="com.android.launcher2.RocketLauncher" android:label="@string/dream_name" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DREAM" /> </intent-filter> </activity>
There is a new category android.intent.category.DREAM, what is it used to do? That RocketLauncher is an Activity?

[Guide] How to add tab on settings.apk

Original thread : http://forum.xda-developers.com/showthread.php?t=1900505
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
FAQ :
Q : Why u create a new thread here?
A : It just for u for CM7 user and i make it to easy tutorial
What u need :
- Apk tool/Apk Manager
- Framework-res.apk and Settings.apk
First Step :
- You need to If framework before decompile settings.apk
- Decompile settings.apk and extract my zip file to ur decompiled directory
- Open strings.xml and add this :
Code:
<string name="personal_settings_tab">Actions</string>
<string name="settings_ics_actions">APPLICATIONS</string>
<string name="program_settings_tab">Google</string>
<string name="settings_ics_google">GOOGLE APPS</string>
- Now, open ids.xml and add this :
Code:
<item type="id" name="tabHost">false</item>
<item type="id" name="tabsLayout">false</item>
<item type="id" name="tabsText">false</item>
- Compile your settings.apk and decompile again.
Second Step :
- Open TabbedSettings.smali and public.xml
- Find and replace with your ID on public.xml
Code:
[B]Find ------------------- Replace with ID of name[/B]
[B]IN smali/com/android/settings/TabbedSettings.smali[/B]
0x7f0c0002 ------------------- slide_out_left (anim)
0x7f0c0003 ------------------- slide_out_right (anim)
0x7f03005c ------------------- type="layout" name="tab_indicator"
0x7f0b011b ------------------- type="id" name="tabsText"
0x7f03005b ------------------- type="layout" name="tab_content"
0x7f0b0119 ------------------- type="id" name="tabHost"
[B]IN smali/com/android/settings/TabbedSettings$1.smali[/B]
0x7f0c0001 ------------------- type="anim" name="slide_in_right"
0x7f0c ------------------- type="anim" name="slide_in_left" (Only first 4 digits)
[B]IN smali/com/android/settings/PersonalSettings.smali[/B]
0x7f040039 ------------------- type="xml" name="personal_settings"
0x7f03005a ------------------- type="layout" name="speed_container"
[B]IN smali/com/android/settings/ProgramSettings.smali[/B]
0x7f04003a ------------------- type="xml" name="program_settings"
0x7f03005a ------------------- type="layout" name="speed_container"
Third Step :
- Open androidmanifest.xml and find this line :
Code:
<activity android:theme="@android:style/Theme.NoTitleBar" android:label="@string/settings_label_launcher" android:name="TabbedSettings" android:taskAffinity="com.android.settings" android:clearTaskOnLaunch="true" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.settings.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- Now replace it with these line :
Code:
<activity android:theme="@android:style/Theme.NoTitleBar" android:label="@string/settings_label_launcher" android:name="TabbedSettings" android:taskAffinity="com.android.settings" android:clearTaskOnLaunch="true" android:launchMode="bottom">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.settings.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="PersonalSettings" />
<activity android:name="ProgramSettings" />
<activity android:label="@string/settings_label_launcher" android:name="Settings">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
- Compile your project and sign it with the same key of rom.
- Push to your /system/app directory and you got it! :good:
Good tutorial men
Hey dude I've got one problem here.. when I try to compile the Settings it got brut error, here the log :
Code:
D:\APKTOOL>apktool b Settings
I: Checking whether sources has changed...
I: Smaling...
[28,14] no viable alternative at input 'type'
[42,14] no viable alternative at input 'type'
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file
: D:\APKTOOL\Settings\smali\com\android\settings\PersonalSettings.smali
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:45)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:66)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:50)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:37)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:257)
at brut.androlib.Androlib.buildSources(Androlib.java:214)
at brut.androlib.Androlib.build(Androlib.java:205)
at brut.androlib.Androlib.build(Androlib.java:176)
at brut.apktool.Main.cmdBuild(Main.java:228)
at brut.apktool.Main.main(Main.java:79)
can you solve it?
^ what ur rom? deodexed or odexed? try to deodexed before decompile ur system file. then u must if framework to.
yeah~~thank you for you guide~~
<activity android:theme="@android:style/Theme.NoTitleBar" android:label="@string/settings_label_launcher" android:name="TabbedSettings" android:taskAffinity="com.android.settings" android:clearTaskOnLaunch="true" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.settings.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
i can not find it
need help..
i cant understand Second Step...
The Step is
fine the "0x7f0c0002" from TabbedSettings.smali
to replaced from new public id right??
Error..
--------------------------------------------------------------------------
|14-Oct-2013 -- 21:25:29.94|
--------------------------------------------------------------------------
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) Client VM (build 23.7-b01, mixed mode, sharing)
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 10, --target-sdk-version, 10, -F, C:\Users\Panneer\AppData\Local\Temp\APKTOOL8040088455671024053.tmp, -I, C:\Users\Panneer\apktool\framework\1.apk, -S, C:\APK-Multi-Tool\other\..\projects\System_Settings.apk\res, -M, C:\APK-Multi-Tool\other\..\projects\System_Settings.apk\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:255)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:324)
at brut.androlib.Androlib.buildResources(Androlib.java:269)
at brut.androlib.Androlib.build(Androlib.java:192)
at brut.androlib.Androlib.build(Androlib.java:174)
at brut.apktool.Main.cmdBuild(Main.java:188)
at brut.apktool.Main.main(Main.java:70)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 10, --target-sdk-version, 10, -F, C:\Users\Panneer\AppData\Local\Temp\APKTOOL8040088455671024053.tmp, -I, C:\Users\Panneer\apktool\framework\1.apk, -S, C:\APK-Multi-Tool\other\..\projects\System_Settings.apk\res, -M, C:\APK-Multi-Tool\other\..\projects\System_Settings.apk\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:253)
... 6 more
C:\APK-Multi-Tool\other\..\projects\System_Settings.apk\AndroidManifest.xml:389: error: Error: String types not allowed (at 'launchMode' with value 'bottom').
hi master, why I could not find a line that is contained in AndroidManifest.xml?
Code:
<activity android:theme="@android:style/Theme.NoTitleBar" android:label="@string/settings_label_launcher" android:name="TabbedSettings" android:taskAffinity="com.android.settings" android:clearTaskOnLaunch="true" android:launchMode="singleTop">
Error
C:\Users\Nicx14\Desktop\Indonesian\SecondStep>apktool b Settings
I: Checking whether sources has changed...
I: Smaling...
Exception in thread "main" brut.androlib.AndrolibException: Could not smali file
: [email protected]1cc55fb
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:45)
at brut.androlib.src.DexFileBuilder.addSmaliFile(DexFileBuilder.java:33)
at brut.androlib.src.SmaliBuilder.buildFile(SmaliBuilder.java:64)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:48)
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:35)
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:222)
at brut.androlib.Androlib.buildSources(Androlib.java:179)
at brut.androlib.Androlib.build(Androlib.java:170)
at brut.androlib.Androlib.build(Androlib.java:154)
at brut.apktool.Main.cmdBuild(Main.java:182)
at brut.apktool.Main.main(Main.java:67)
Pls. fix this problem? pls reply to me...
hi pls help
hey androidManifest.xml part didnt worked for me.. pls help..
Code:
<activity android:theme="@android:style/Theme.NoTitleBar" android:label="@string/settings_label_launcher" android:name="TabbedSettings" android:taskAffinity="com.android.settings" android:clearTaskOnLaunch="true" android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.settings.SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
i m on stock deodex 4.2.2 rom.. Samsung i9082

BOOT_COMPLETED broadcast message not received

I have a Samsung Galaxy j7 Max, I am trying to make an app that is suppose to start on reboot and power on. I have declared the following permission in my AndroidManifest.xml-:
Code:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Also I have declared the following broadcast receiver-:
Code:
<receiver
android:name="homeutil.sreyan.homeutil.BootCompleted"
android:enabled="true"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.REBOOT"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
But no matter how many times I power off or restart my phone I the broadcast receiver for the Boot completed event is never fired.
Can someone please help me ? Is there something I am doing wrong ? my phone uses fingerprint and password as a security lock, can those be causing a problem ?

Categories

Resources