Using the companion:
screen1 does not do initialize but if I "Do It" then it works.
I tried "Refresh Companion Screen" but that doesnt work either.
Any advice please?
Please show your relevant blocks
Info on your companion setup may also help (companion app version, phone/device, Android version)
Motorola Moto E, android version 6 phone,
Companion Version 2,58a
This permission is already set in the companion app.....
Thanks for the speedy response.
OK that might explain a few other things.
I copied the file its in from https://puravidaapps.com/file.php
which is a demo prog, the fact that the block doesnt run and stops the Permision granted block
from running because the condition is already true could easily confuse beginners like me.
It would be nice if the AskForPermission replied true.
Try a compiled version on your device (apk)
Also recommend using WRITE_EXTERNAL_STORAGE - this give READ permission as well
Just run a test on my companion, seems to be a timing issue, using a clock set at 100 millis, it works!
If permissions are to be checked, you always have to test them with the compiled app (APK).
As @TIMAI2 said, WRITE_EXTERNAL_STORAGE is sufficient as it implicitly grants READ permission.
https://developer.android.com/reference/android/Manifest.permission
Btw, these are (all) the permissions declared in the Companion APK:
Permissions AI2 Companion
<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
<uses-feature android:name="android.hardware.location" android:required="false"/>
<uses-feature android:name="android.hardware.telephony" android:required="false"/>
<uses-feature android:name="android.hardware.location.network" android:required="false"/>
<uses-feature android:name="android.hardware.location.gps" android:required="false"/>
<uses-feature android:name="android.hardware.microphone" android:required="false"/>
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.wifi"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.NFC"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<uses-permission android:name="android.permission.ACCOUNT_MANAGER"/>
<uses-permission android:name="com.google.android.apps.googlevoice.permission.RECEIVE_SMS"/>
<uses-permission android:name="com.google.android.apps.googlevoice.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<uses-permission android:name="android.permission.READ_LOGS"/>
It doesn't make sense to test permissions with Companion, because they are always granted.
You have to know if they are declared in your APK (Manifest).
Putting WRITE_EXTERNAL_STORAGE didnt change anything for the companion but when I installed the apk it worked.
Your timing method worked in the companion.
... and you will get "true" for every permission request.
So what could you learn from it?
I guess it is more about the workflow, having to do one thing for companion (e.g. not ask for permission) then set up to ask for permission before compiling. It is a bit like the pathToAssets thing....
OK Anke I learnt what you put in your first post here and now have the link to developer/android with useful information.
But here is another problem for me to investigate, when I try to Build App and generate a QR code I get Error 404 Invalid link on my phone, so I have to save to my computer then to cloud and then download from cloud !!!!
Thanks TIMAI2
Why don't you simply connect your device to the PC via USP and copy the APK to your device.
Hi Jim
Have you set your phone to Developer Mode? If not, that could result in rejection of your test APK.
https://www.professorcad.co.uk/smartphonescreensizes#SetDebugMode
https://www.professorcad.co.uk/appinventorerrormsgs
I get the error when I try to load the .apk file to my phone using the QR code generated in APP inventor.
OK I can connect my phone easily enough to update the companion but I cant see how to send the .apk file to my phone. I see the .apk file in Explorer - Downloads and try to drag it to the mobile phone under "This PC" but nothing happens.
Have I missed something.
Example from a Nexus 5x:
Swipe down from top to bottom
"Device is charged via USB", click here and then click on "transfer files".
OK I already done that but now how do I transfer the .apk file to the phone as opposed to connecting to the companion.
OK so yesterday I could not copy paste or drag the file in explorer to my phone but today I can.
Thanks for all the help.
Jim
Some information which may be of help to others.
I tried again today to copy an .apk file from Explorer on my PC to my phones Download folder without success, however I could copy over all sorts of other files.
I looked at the apps on my phone and saw that I had an earlier Kodular app with a different name still installed so I uninstalled it and now I can copy paste or drag the .apk files OK.
Not sure exactly what is going on but it works.
Jim
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.