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.
Related
We wrote all permission codes between suitable tags. But when i install the program there is no ask about permissions.
Where is my fault?
this my manifest.xml file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.berker.notkayit">
<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="24" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
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>
Writing permissions in Manifest file won't ask permissions on runtime. In order to show permissions, you need to write code in your application instances. Refer this link https://developer.android.com/training/permissions/requesting.html
are u testing the app in marshmallow or above device means it won't ask for permission during installation but it will permission during run time have u added the runtime permission codes
It dependences on your devices, if you device Android version is below 6.0, then you way is ok, however, if you device version is 6.0 and above then you need add runtime permission, check this link https://github.com/googlesamples/easypermissions
I was recently creating an app that uses bluetooth. The problem is my app crashes when ever I start the bluetooth service. Here's my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.petalappstudio.fit" >
<uses-permission android:name="ANDROID.PERMISSION.BLUETOOTH"/>
<uses-permission android:name="ANDROID.PERMISSION.BLUETOOTH_ADMIN"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
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=".bluetoothManager"
android:enabled="true"
android:exported="true">
</service>
</application>
Now as you can see I have added permission for bluetooth and bluetooth admin.
How ever my app crashes and in LOGCAT the error is
"java.lang.RuntimeException: Unable to start service " and is caused by
"java.lang.SecurityException: Need BLUETOOTH ADMIN permission: Neither user 10145 nor current process has android.permission.BLUETOOTH_ADMIN."
But I have added permission as you can see. Now why is this happening ?
Try to add one more permission :
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Refe. : Android Permission BLUETOOTH Manifest error
Note : also check device support Bluetooth feature or not using :
<uses-feature android:name="android.hardware.bluetooth" android:required="true" />
My application launches well both on Nexus 7 and Nook Tablet, but doesn't start on Kindle Fire with the following error:
Error: Activity class {com.js.pathoflight/com.js.pathoflight.JSNativeActivity} does not exist.
Here is my manifest complete:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.js.pathoflight"
android:versionCode="3"
android:versionName="0.8.3">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:allowBackup="true"
android:hasCode="true" >
<activity android:name=".JSNativeActivity"
android:label="#string/app_name"
android:configChanges="orientation|keyboardHidden"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
<meta-data android:name="android.app.lib_name"
android:value="PathOfLight" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
It seems like a device issue, but I have another (similar) application which runs on the same device well.
How can I solve it?
The real problem was that there were another application with the same package name on device (I tried a sample and gave it my real app package name)! When I removed it everything became working right!
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"/>
I am developing some app for android which worked well untill this evening.
However the app is working well in emulator but on Archos 80 G9 tablet with android 3.2.80 I got this error
The application Package installer (process com.android.packageinstaller) has stopped unexpectedly. Please try again.
Also here is my manifest XML
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="oni.dani"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="13"
/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:debuggable="true"
>
<activity
android:label="#string/app_name"
android:screenOrientation="portrait"
android:name="com.android.onidani.Dashboard" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.android.onidani.KlasaPrikazBaze"></activity>
<activity android:name="com.android.onidani.Dashboard"></activity>
<activity android:name="com.android.onidani.OniDaniActivity"></activity>
</application>
</manifest>
This error is occuring because you have declared your Dashboard activity twice.
<activity android:name="com.android.onidani.Dashboard"></activity>
You should add permission declaration in your manifest file. E.g
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
error: 'unfortunately package installer has stopped'. This happens when application needs permissions like location, phone call, Read external storage, write external storage etc. If permission is not defined in the manifest file then i get this kind of error message.
Add permission in manifest file according to your need
i need read/write file so i added below permission (outside of application)
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
in my situation i was passing empty array to requestPermissions. so check if your array is'not empty (String[] permissions)