Closed thomwiggers closed 6 years ago
If I find time I will try to update it
+1. This is a huge problem for me because I published a new Android app to the store that was built with SDK 23, and now I cannot downgrade. So anyone who installs the app with Android 6 will have a broken app.
could you try with the latest master?
you can try to install the latest preview via
cordova plugin add cordova-plugin-barcodescanner@next
Also interested in this fix. I installed the @next version of the plugin and am now getting an error when i run scan():
write settings:
false``
you can try again. Having not much time to verify it
Still not working for me (((
you used cordova-plugin-barcodescanner@next?
yes, and version I saw in config.xml was 0.8
could you try
cordova plugin add cordova-plugin-barcodescanner@next
?
Hi,
I tried and still have "write settings:false" on @next version
Ok cool
On Thu, Apr 13, 2017 at 6:05 PM, lionelhe notifications@github.com wrote:
Hi,
I tried and still have "write settings:false" on @next https://github.com/next version
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hypery2k/cordova-barcodescanner-plugin/issues/12#issuecomment-293905099, or mute the thread https://github.com/notifications/unsubscribe-auth/ADekRv8F7wnLIaSs2V9prnJpz6RLpDrUks5rviungaJpZM4IwNum .
As seen in https://github.com/phonegap/phonegap-plugin-barcodescanner/issues/139
I used the https://github.com/NeoLSN/cordova-plugin-android-permission to handle the problem.
When trying to use QR Code I just call
let permissions = cordova.plugins.permissions;
permissions.checkPermission(permissions.CAMERA, (status) => {
if (!status.hasPermission) {
permissions.requestPermission(
permissions.CAMERA,
(status) => {
if (!status.hasPermission) {
errorCallback();
} else {
this.launchQRCodeScan();
}
},
errorCallback);
} else {
this.launchQRCodeScan();
}
}, errorCallback);
it won't work on Android 6.0. I try again and again, still have "write settings:false"
I have meet this problem and it won't work on Android 6.0.1. it is similar to jb12467. still have "write settings:false"; my cordova version is 7.0.1
I have solve this problem,you can follow this;
1.add cordova-plugin-android-permission,then request permission ,however, it doesn't work; don't give up; why add this plugin? because it will add <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
in AndroidManifest.xml If it doesn't work ,you can add by hand;
add this code in MainActivity.java; `
private void requestWriteSetting(){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if(Settings.System.canWrite(MainActivity.this)){ // Do stuff here }else{ Intent intent = new Intent(android.provider.Settings.ACTION_MANAGE_WRITE_SETTINGS); intent.setData(Uri.parse("package:"+ getPackageName())); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } } }
`
and then call this method in onCreate method; like this: `
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// enable Cordova apps to be started in the background
Bundle extras = getIntent().getExtras();
if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
moveTaskToBack(true);
}
// Set by <content src="index.html" /> in config.xml
loadUrl(launchUrl);
requestWriteSetting();
}
`
it work in my project,and my phone is samsung android 6.0.1.
@qiaojiange hello and thank you , but this methode return, an error while building the app ! unsafe method , what can i do ? thank you again
The write settings rights are presents on the plugin until 0.7.0 The 0.7.1 version only remove this right, so I use 0.7.0 version on my application and I don't have problems.
I've been pulling my hair out and I have no hair. This 0.7.0 version is the answer...thanks a great deal...
After a day an a half trying to track down this same error I finally also fixed it by reverting to 0.7.0
yes,you can revering to 0.7.0 successful,however, i have try my project with this method but it doesn't work! you can try per method until save you problem due to every person will meet different situation.
I reverted the changes and published 0.7.2
This plugin should request the camera permissions, otherwise it won't work on Android 6.0 if you're targeting sdk level 23
https://cordova.apache.org/docs/en/latest/guide/platforms/android/plugin.html