SMS sending permission on Active Android device - android

I'm a newbie with android development. So far I have developed an application which uses SMSManager.
I'm testing my application on an active device when it reaches smsManager.sendTextMessage it throws exception of android.premission.SEND_SMS.
I know that I have to get device permission.
My Question is:
Can I send SMS while uploading application right from IDE, or have to install .apk manually?

You must add the following permissions in your Manifest file:
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />

If you install the application via debugging/IDE/ADB it will automatically get the permissions you require in your manifest.
So: Yes! When run on the device through the debugger, the application will be able to send test messages.
Bonus information: If you do "stuff" that the application doesn't have the proper permissions for, the debugger will give you exceptions and hints to what is wrong.

Related

No Bluetooth permissions granted when coding the example app from Android developer

Sorry, that questions sound stupid but drives me crazy.
I'm about implementing an app very similar to the Bluetooth App described in Developer Android.
I don't get required permissions, though.
Yes, I ask for permission twice
a) in my manifest
b) and I check before using BT with
ActivityCompat.requestPermissions(..)
In logcat, see belove, I learn that my app doesn't get Bluetooth permission.
It isn't the first time I write a BT app. LAst time it was fine. But was a while ago.
My mobile (Nexus 5) told me something about Development Mode Active and apps would be routed to Developer Manager to be started as instant app.
I also learned that Bluetooth access is not granted to instant apps at all.
(I understand that.).
Could that be the problem? Does Android Studio produce different apps now. Does it interact in a different manager with the test hardware?
If so, how do I pursuade Android Studio to not produce an instant app?
Thank you so much in advance.
my manifest code
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
Log output:
android.permission.BLUETOOTH: denied
and some lines earlier
I/ActivityManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.android.packageinstaller cmp=com.google.android.instantapps.supervisor/.permissions.GrantPermissionsTrampoline (has extras)} from uid 10029 on display 0
W/Isotope: UID: [10029] PID: [14812] GrantPermissionsTrampoline : Permission not allowed: android.permission.BLUETOOTH
Sorry for bothering you... It was so easy. I have just deactivated that instant apps dev manager on my Android phone.
Voila, my app is an app again and no instant app. It gets all
permissions it need. Anything is fine.
I'm sorry again.

Cordova Android app and user permissions

I have an Android Cordova app and I'm using GPS, check the network state, read/write on the Documents folder and taking camera pictures. Here my permissions on the manifest XML file:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
The manifest file is auto generated by the Cordova framework. For some reason I don't see camera permissions. Permissions are not asked at installation time anymore (that's since Android 6) but instead they should be asked before usage.
I correctly get the GPS access permission popup but not the read/write Documents folder permission. I also never get the camera permission albeit I'm able to use it without ever being asked for permission. Same story for the Network status permissions (never being asked).
I find Android permissions scheme extremely confusing, under application manager my app has got Location and Storage as expected, Camera and Network status are missing though.
To recap, inside the app, on the actual code, I'm using at least once those devices
GPS fine grained
GPS coarse (probably the Wifi SSID triangulation trick)
Write on Documents
Read on Documents
Read network status (Offline / Wifi / 3G etc..)
Take picture from the camera
Cordova framework wrote this manifest file:
android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION
android.hardware.location.gps (why is it not a .permission?)
android.permission.ACCESS_NETWORK_STATE
android.permission.WRITE_EXTERNAL_STORAGE
On application manager I get those options:
Location
Storage
So basically I get three different sets of permissions :-(
I found this in the this cordova plugin that you mentioned in comments.
So somehow this <uses-permission android:name="android.permission.CAMERA/> have to be in your code so as this plugin can use it.
Maybe you didn't check the right program to see its permissions, or if the camera permission is not shown in application permissions on device, you can't be able to use camera in this application. Please do a check again because I really want to know what is the situation.

Android TelephonyManager doesn't work with android studio simulator?

I am using this simple code to retreive some phone device data, but for some reason any time I open the app on the emulator, it pops up a message saying "Unfortunately *APP NAME* has closed" and then it shuts down the app.
this is the code I am using:
TelephonyManager tm=(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
String IMEINumber=tm.getDeviceId();
I wrote that code just to test the Telephonymanager methods but nothing works except for:
"getPhoneType();"
any ideas what's the problem? maybe it is because I am runing it on my android studio emulator?
the problem it says: getDeviceId: Neither user 10058 nor current process has android.permission.READ_PHONE_STATE though I added a permission in the manifest:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
(above the application part)
thank you for your help

Does this Android permission prevent me from getting error reports?

In my application descriptor file there is this line:
<!--Removing the permission android.permission.INTERNET will have the side effect
of preventing you from debugging your application on your device-->
<uses-permission android:name="android.permission.INTERNET"/>
Does this mean I won't be able to debug my application with Flash Builder or does it mean that if my app crashes as a user is running it I won't get error reports in Google App developer center?
Nope and No! This is just a permission it wouldn't affect any of the above. It just allows your application to connect to Internet.
But maybe your application needs Internet just to work properly.
ANR and Crash reporting is integrated into OS, and handled via Play Store services. It has nothing to do with your App's permissions.

Appcelerator Android app starts crashing when Internet is turned Off

I am working with Titanium Appcelerator 1.8.1 Android SDK. App is working perfect when Internet connectivity is on. But when I turn the connectivity is off, App crashes in the start. Nothing works as expected. I am supposed to develop offline feature, which enables app to be working as expected when it's offline and syncs data when it is online.
I had used following permission set:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Branch your logic like
if(Ti.Network.online){
//sync data
}else{
/fetch data from local persisitance
}
And FYI i guess Titanium takes care of adding these permissions to the manifest file by default.
That may be caused by the "Live view" option activated, it need the mobile to be in the same network as the PC where Appcelerator is running. If you are developing an offline app, you have to unselect that option, that way you can run your app without beeing in the same network as the PC.
Image of Live View option

Categories

Resources