Service failing to run because of "Permission Denial", permission required is null - android

My program has been running fine, but I think I must have accidentally changed something I shouldn't have done. I had my program running "UpdateService" on the press of a button, but now it doesn't run, and debug brings up the following two lines:
01-05 21:43:39.945: WARN/ActivityManager(98): Permission denied: checkComponentPermission() reqUid=10084
01-05 21:43:39.955: WARN/ActivityManager(98): Permission Denial: Accessing service ComponentInfo{com.android.datausagemonitor/com.android.datausagemonitor.UpdateService} from pid=98, uid=1000 requires null
Here is my manifest, judging by similar posts it could well be a problem with this, but I can't see it and am pretty sure I haven't changed anything since it was last working:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.datausagemonitor"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.READ_CONTACTS"></uses-permission>
<uses-permission android:name="android.permission.READ_SMS"></uses-permission>
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".DataUsageMonitorActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.android.datausagemonitor.UpdateService"></service>
<service android:name="com.android.datausagemonitor.ResetService"></service>
</application>

[Solved] There was some problem with the Uid between Eclipse and the device I was testing on. Rebooting the device solved the problem.

Related

Android bluetooth permission exception

In my bluetooth application i got the below exception anyone can help to solve this.
08-29 13:07:08.370: E/DatabaseUtils(31342):
java.lang.SecurityException: Permission
Denial: writing com.android.bluetooth.opp.BluetoothOppProvider uri
content://com.android.bluetooth.opp/btopp from pid=9760, uid=10110
requires android.permission.ACCESS_BLUETOOTH_SHARE, or
grantUriPermission()
My manifest file is
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="process.bluetooth.sendfile"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7"
android:maxSdkVersion="17"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.BLUETOOTH" android:label="BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<permission android:name="android.permission.ACCESS_BLUETOOTH_SHARE"
android:protectionLevel="signature" />
<application android:icon="#drawable/bluetooth"
android:label="#string/app_name"
android:allowBackup="true">
<activity android:name="process.bluetooth.sendfile.SendFileActivity"
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>
if you are trying it for Android 4.1 or above, then the permission to write directly to the content provider is now protected with "signed" meaning you would have to sign your app with the same key used to sign the bluetooth app.
Source this answer on almost similar question Android bluetooth print stopped working on 4.1 . See link for solution.

neither user or current process has android.permission.BLUETOOTH

I have a simple app that so far just turns bluetooth on/off, when i run it on emulator or on a nexus 7 it says my app has stopped responding and then closes itself upon launch.
I tried adding an onStart() method since that fixed this issue in a similar question, adding the intent that gets users permission and switching around various things to different methods, still crashing however.
Logcat has these messages:
07-29 01:05:41.541: E/AndroidRuntime(9745): FATAL EXCEPTION: main
07-29 01:05:41.541: E/AndroidRuntime(9745): java.lang.RuntimeException: Unable to start activity ComponentInfo{mypackagename/mmypackagename.MainActivity}: java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10067 nor current process has android.permission.BLUETOOTH.
Here is my manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mypackagename"
android:versionCode="1"
android:versionName="1.0" >
<uses-feature android:name="android.hardware.bluetooth" android:required="true" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BlUETOOTH"/>
<uses-sdk
android:minSdkVersion="5"
android:targetSdkVersion="16" />
<application
android:icon="#drawable/homeiconsmall"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main"
android:launchMode="singleTask"
android:alwaysRetainTaskState="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
You misspelled the permission in your manifest (BlUE != BLUE):
<uses-permission android:name="android.permission.BlUETOOTH"/>

Android "Application is not found on your phone" from launcher ..?

When I launch my application from eclipse (run), It starts up on my phone or emulator, working... This also puts the app in the appdrawer, however, when I press it it says: "Application is not installed on your phone". This is not because it's just an empty shortcut on my homescreen, it actually shows up in the drawer. I tried removing and reinstalling it, but that didn't help either.
Atached is my AndroidManifest.xml since I suspect the problem coming from there.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.application.package"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="#drawable/icon" android:label="#string/app_name" android:permission="android.permission.INTERNET">
<activity android:name=".UserInteraction" android:permission="android.permission.INTERNET"
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=".WebViewClass"
android:label="#string/app_name"/>
</application>
</manifest>
#MByD is spot on, but it's not just "not needed" but "actively causing you problems". Get rid of the android:permission attributes. You are saying that the launcher has to hold the INTERNET permission to launch your app, and the launcher probably does not have that permission.

Android "Permission Denial"

I have been working on an Android 2.2 app for the past three months, but decided this past week to try to build the app using Android 2.1 SDK. The app ran fine under 2.2 in the emulator, and I was able to build the source as a 2.1 project successfully, but when I try to run the app in the 2.1 emulator, I get the following runtime error:
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.tampamobileapps.testapp/.LoginScreen } from null (pid=-1, uid=-1) requires null
The app is not that complicated and only makes HTTP POST and GET requests. It also supports PayPal payments, but this API worked fine under 2.2. I have googled this error message and have not found any solutions to get rid of the error.
Any ideas?
Edit:
Here's the relevant parts of the Android manifest; the LoginScreen currently does nothing of consequence.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon"
android:debuggable="true"
android:label="#string/app_name"
android:name=".SharedApplicationContext">
<activity android:name=".LoginScreen"
android:label="#string/login_screen_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginScreen"
android:label="#string/app_name">
</activity>
<activity android:name=".MainMenu"
android:label="#string/app_name">
</activity>
</application>
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
</manifest>
You have duplicate activities defined in your manifest for .LoginScreen. Try removing:
<activity android:name=".LoginScreen"
android:label="#string/app_name">
</activity>
You may need to use the android:exported="true" option.
For instance, preference activities in live wallpapers need this set. Hope this helps someone else as I know you have probably already sorted the issue.

APK Deployment Issue

I have been able to create a *.apk file from my code, place the file
in IIS, and download it onto a number of Android phones. Upon the
install, the application works exactly as expected.
However, after a phone is rebooted, the application name is changed to
the fully-qualified Java class name of the activity in the menu (so
"MyActivity" becomes "com.mycompany.MyActivity"), and when I try to go
to Menu > Settings, I get an error that causes android to force close
my application.
Looking into DDMS, I see that I get an error indicating that it can
not find my Preferences activity, despite the fact upon initial
install, it works properly.
I'm using Eclipse on Windows XP, and have several Android devices at
my disposal to test with.
Any idea what's going on?
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.app"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/logo" android:label="#string/app_name"> <!--android:debuggable="true">-->
<activity android:name="com.company.app.ActivityMain"
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.company.app.Preferences"
android:label="#string/app_settings">
<intent-filter>
<category android:name="android.intent.category.PREFERENCE"></category>
<action android:name="android.intent.action.MAIN"></action>
</intent-filter>
</activity>
<service android:name="com.company.app.Service"></service>
</application>
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest>
So I finally got this to work. I think that the package installer on the HTC Hero (and maybe the HTC Droid Eris) has some issues.
I uninstalled my application from the phone, changed the name of my main activity, and re-deployed it onto the Hero. I started to immediately get a "Force Close." I connected the device to DDMS and looked at the error. It was still looking for my old activity name. I factory reset the device and reinstalled the same package (with the updated name) and everything works as expected.
So it seems that the package installer is caching some part of the old manifest or something, not really sure what exactly is going on there. I may play with it some more if I get time.
I don't know if someone else could verify this problem, maybe it's something that should be taken up with HTC?
try to use this manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.app"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/logo" android:label="#string/app_name"> <!--android:debuggable="true">-->
<activity android:name=".ActivityMain"
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=".Preferences"
android:label="#string/app_settings">
<intent-filter>
<category android:name="android.intent.category.PREFERENCE"></category>
<action android:name="android.intent.action.MAIN"></action>
</intent-filter>
</activity>
<service android:name=".Service"></service>
</application>
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest>

Categories

Resources