Android Permission Denial starting Intent for Wallpaper Settings - android

Unfortunately when I try to run my wallpaper I get an error message saying Permission Denial starting Intent and requires android.permission.BIND_WALLPAPER but I can't seem to figure out why. My manifest looks like the following:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package">
<uses-feature android:name="android.software.live_wallpaper" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<application
android:exported="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:permission="android.permission.BIND_WALLPAPER">
<service
android:name="WallpaperService"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:permission="android.permission.BIND_WALLPAPER">
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/livewallpaper" />
</service>
<activity
android:name=".WallpaperSetClass"
android:exported="true"
android:permission="android.permission.BIND_WALLPAPER"
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>
</manifest>
The live wallpaper does run perfectly if I set it through the live wallpaper part of my phone, but I would like to have a settings area as well to be able to open in which I can't.
At the moment my settings class is basically empty containing just an onCreate function and a layout with a button.
Is there something I'm missing? I seem to have the permissions along with android:exported

Turns out I had
android:permission="android.permission.BIND_WALLPAPER"
In the wrong spot, it should be in the service tag, and only have ONE, having multiple will break it.

Related

can't open android app from menu/ problems with permisions

I have a problem with launching this app through menu. There is no problem when I start it using a different application that has permission. This is the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.michael.dangerouslab" >
<uses-permission android:name="course.labs.permissions.DANGEROUS_ACTIVITY_PERM"/>
<permission android:name="course.labs.permissions.DANGEROUS_ACTIVITY_PERM"
android:protectionLevel="dangerous"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:permission="course.labs.permissions.DANGEROUS_ACTIVITY_PERM">
<activity android:name=".DangerDanger" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="course.labs.permissions.DANGEROUS_ACTIVITY"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
Delete both occurrences of android:permission="course.labs.permissions.DANGEROUS_ACTIVITY_PERM" (one in <application>, one in <activity>).
Those say "no third-party app, including the home screen, can do anything with my app, unless they have <uses-permission android:name="course.labs.permissions.DANGEROUS_ACTIVITY_PERM"/> in their manifest". There are roughly zero apps that have such an element, including roughly zero home screen implementations. Hence, you will not be able to launch your app.

Label attribute in AndroidManifest.xml

I have a manifest with its label declared so the launcher label is different from the Main Activity (the one that is launched at start).
It was working fine, but today I saw on a friends phone it took the activity's label instead.
I have no idea what could be happening.
If it is of any help, the phone was a Motorola Razr.
Here's the relevant portion of the manifest:
<application
android:name="com.app.eventiame.EventiameApp"
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock.Light.DarkActionBar" >
<activity
android:name="com.app.eventiame.MainActivity"
android:label="#string/title_activity_main" >
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You have wrote
android:name="com.app.eventiame.EventiameApp"
instead you can just specify your app name here as below
android:name="EventiameApp"

Broadcast receiver is not stopping

i am working on an app that will automatically decline incoming calls from specific numbers and send an sms in return.my broadcast receiver should be enabled from my app only.
so, i added ( android:enabled="false" ) this. but, the receiver is still on by default. i'm struck here.
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.sifydy.automsgr.Automsgr"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="com.sifydy.automsgr.Receiver"
android:label="#string/app_name"
android:enabled="false">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
</receiver>
</application>
wen i switch on my mobile, my receiver is also activated wen ever there is an incoming call.
i am able disable it from my app. everything is fine once i am in my app. how to disble it by default?

Problem calling activity from another package in Android

Situation:
I need to combine several apps into one .apk app. Lets say implement app2 into app1
What i have done:
Copied app2 package into main app1 project which i am working, so my app1 has two packages.
app2 had this manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.app2" android:versionCode="3" android:versionName="1.2">
<application android:label="App2" android:icon="#drawable/icon">
<activity android:name="Activity1" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="Activity2" android:excludeFromRecents="true"></activity>
</application>
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
</manifest>
My original App1 manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.app1">
<application android:icon="#drawable/icon" android:debuggable="true">
<activity android:name=".Start" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.package.app1.PlayerList" />
<activity android:name="com.package.app1.CreateNewPlayer" />
<activity android:name="com.package.app1.Profile" />
<activity android:name="com.package.app1.Braintrainer" />
</application>
</manifest>
The code in app1 i am using to call activity in app2 package:
Intent i = new Intent();
i.setClassName("com.package.app1", "com.package.app2.Activity1");
startActivity(i);
The question:
How do i modify my app1 manifest file to have activities of app2.
Things i`ve tried:
It works if i create simple HelloWorld test class in app2, call using the same code and just include this in the app1 manifest:
<activity android:name="com.package.app2.Test" />
But i can not figure out how to implement the app2 manifest file into the first one. Every way i try give no errors but crashes when calling that activity. App2 alone works fine, so problem not in the activity file.
Appreciate any thoughts on this.
Intent i = new Intent();
i.setClassName("com.package.app1", "com.package.app2.Activity1");
startActivity(i);
Shot in the dark:
change com.package.app1 to com.package.app2. I've called done what you're attempting right now, and I've always had to specify the package of the class I wanted to call.
Ok, PackageManager is not your solution, I misread and thought you had two apps and wanted one app to call the other. It looks like you just want one app.
Modify your app1's manifest like this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.app1">
<application android:icon="#drawable/icon" android:debuggable="true">
<activity android:name=".Start" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.package.app2.Activity1" />
<activity android:name="com.package.app2.Activity2" android:excludeFromRecents="true"></activity>
<activity android:name="com.package.app1.PlayerList" />
<activity android:name="com.package.app1.CreateNewPlayer" />
<activity android:name="com.package.app1.Profile" />
<activity android:name="com.package.app1.Braintrainer" />
</application>
<uses-permission android:name="android.permission.WAKE_LOCK"></uses-permission>
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
</manifest>
And try the first way again.
I have several packages and need to do something similar in my app.
You need to be careful with this technique, otherwise you'll experience nasty memory leaks.
I declared my activity in my base controller (activity) class as a static variable. All controller classes inherit from this class, so all controller classes are able to access it. Pass in the activity as an argument for anything outside of the controller classes that need to access the activity.

android multiple activity declaration in manifest

I have a main activity. From it, I am calling 2 other sub activities called FacebookLogin and Twitterlogin. I am using the following code in AndroidManufest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.examples.Kikin" android:versionCode="1"
android:versionName="1.0">
<!-- THIS IS THE BEGINNING OF SHARING LINKS FROM THE BROWSER -->
<application android:icon="#drawable/kikinlogo"
android:label="#string/app_name" android:debuggable="true">
<activity android:name=".Kikin" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity android:name=".FacebookLogin" android:label="#string/app_name">
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<!-- <data android:mimeType="image/png" /> -->
</intent-filter>
</activity>
<activity android:name=".TwitterLogin" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="yourapp" android:host="twitt"></data>
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
Am i doing it right?
Should i nest the FacebookLogin and TwitterLogin activities in the main activity?
The aforesaid 2 classes are in the package com.examples..
* is the same wherever used.
The labels for your FacebookLogin and TwitterLogin appear to be missing an '#' - change them to android:label="#string/app_name"
There's no such thing as a "subactvity". Just because you call one activity from another doesn't mean it's a "subactivity".
You can't nest activity tags in the manifest and you'd probably get a compile error if you tried.
in manifest you can set only one activity in launcher tag okay android does support multiple launcher activity.
The manifest you posted looked fine.
But regarding your comment about the error message "Have you declared this activity in AndroidManifest.xml?", you need to check carefully the package and class name of the Activity you are trying to launch, and make sure that it matches the <activity android:name> you have written in the manifest.
All the info you need should be in the error message.
Don't nest activity declarations, just have them all as elements in your application element:
<manifest ...
<application ...
<activity ...
</activity>
<activity ...
</activity>
<activity ...
</activity>
</application>
</manifest>
The sample you posted here (indenting aside) looks fine.
Maybe you have tested it already but just try declaring your activities with the full path (although you have already declared it in the package tag). So, instead of using
<activity android:name=".TwitterLogin" />
use
<activity android:name="com.examples.Kikin.TwitterLogin" />
Sometimes problems are caused because of that.
I know this is an old thread but Im having the same problem and in my case specifying full package name doesnt help. Have you already found a solution? I`m really interested in knowing how to avoid this error.

Categories

Resources