Android permissions for pinging network - android

I'm working on android app which do some pings on LAN, using C# System.Net.NetworkInformation.Ping class. What kind of android manifest permission do I need? For now I have only android.permission.INTERNET, but it seems not enought.
Many thanks for any help.

add these two permissions :
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

Related

Still getting the warning on Google Play Store that the App will be removed even though I've removed the permissions from Android Manifest

After the update to Google Policy I've removed the permissions for CALL_PHONE and SEND_SMS from my AndroidManifest.xml.
After uploading the latest version (yesterday) when I login to my Publish Dashboard, I'm still getting the warning that the application will be removed on 9th January.
These are the permissions I'm using in the Manifest now.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
This is the warning I'm getting.
I've also noticed that if I check the Permissions used in the Google Play Listing, they are:
This app has access to:
Location
approximate location (network-based)
precise location (GPS and network-based)
Phone
read phone status and identity
Photos/Media/Files
read the contents of your USB storage
modify or delete the contents of your USB storage
Storage
read the contents of your USB storage
modify or delete the contents of your USB storage
Wi-Fi connection information
view Wi-Fi connections
Device ID & call information
read phone status and identity
Phone
directly call phone numbers
read phone status and identity
Other
receive data from Internet
mock location sources for testing
view network connections
full network access
prevent device from sleeping
read Google service configuration
Is this due to the READ_PHONE_STATE Permission? or does this take some time to update?
There might be some permission available in some other module or library you are using in project
Please remove manually from manifest like this
uses-permission android:name="android.permission.READ_SMS" tools:node="remove"
uses-permission android:name="android.permission.RECEIVE_SMS" tools:node="remove"
hope it will help

My App is not compatible on WiFi only devices

I developed an android app which shows the caller's Telecom Location on Incoming Call.
I uploaded it on Google Play, but this app does not appear on WiFi only devices, it says your device is not compatible .
My Manifest permission details are below.
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
I doubt about following permissions
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Which particular permissions are creating problem?
What is the solution.
Thanks
The google play store filters applications based on the permissions they require and the features available in the android device. So, your app will not show up in WiFi only devices because the app requires the CALL_PHONE permisssion and the MODIFY_STATE_PERMISSION.
The MODIFY_PHONE_STATE permission does not allow you to place calls but it implies that telephony is a requirement.
Source : https://developer.android.com/guide/topics/manifest/uses-feature-element.html#permissions
Hence, you should use the <uses-feature> element instead of the above mentioned permissions.
From Docs : You can disable filtering based on the implied feature by explicitly declaring the implied feature, in a element, with an android:required="false" attribute.
In your case :
<uses-feature android:name="android.hardware.telephony" android:required="false" />
But then you also need to ensure that you do not use any of the telephony related features before actually checking if it's available of not.
In the android app, for SDK >=5 , you should use :
PackageManager pm = this.getPackageManager();
boolean hasTelephony = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
You are correct to suspect the following...
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Certain permissions "imply" the necessity for certain hardware to exist. In other words, permissions relating to the phone require the device to have phone capabilities (obviously).
You can get around this by using the <uses-feature> element in the AndroidManifest.xml. This allows you to specify if the 'feature' is required or not.
Take a look at the documentation for <uses-feature-element>
In particular the Permissions that Imply Feature Requirements section which explains the requirements related to the <uses-permission> elements.
EDIT: One more thing - if a feature CAN be used but it's not REQUIRED, it is up to you to check for its availability in your code before attempting to use it otherwise you'll get unpredictable results or possible exceptions / crashes.

<uses feature> tan in android

<uses-permission android:name="android.permission.PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_USER_DICTIONARY" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_USER_DICTIONARY" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-feature
android:name="android.hardware.location"
android:required="false" />
<uses-feature
android:name="android.hardware.location.gps"
android:required="false" />
<uses-feature
android:name="android.hardware.location.network"
android:required="false" />
<uses-feature
android:name="android.hardware.wifi"
android:required="false" />
<uses-feature
android:name="android.hardware.telephony"
android:required="false" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
I have basically declares this in the manifest. I want to know what exactly uses feature does.
From my understanding, if i declared permission access_coarse_location and all that, this means my app uses feature android.hardware.location ..and for that automatically thats set for true.
By specifying that feature to false, am telling android store..that a user can download this app even if he doesn't have location hardware..because this thing is handled inside code?
Is my understanding right? Because i find it funny there is feature android.hardware.wifi ..
what phone, mobile device doesn't have a wifi?
yup your understanding is correct.
From https://developer.android.com/guide/topics/manifest/uses-feature-element:
Google Play uses the elements declared in your app
manifest to filter your app from devices that do not meet it's
hardware and software feature requirements. By specifying the features
that your application requires, you enable Google Play to present your
application only to users whose devices meet the application's feature
requirements, rather than presenting it to all users
I want to know what exactly uses feature does
Quoting the documentation:
The purpose of a declaration is to inform any external entity of the set of hardware and software features on which your application depends. The element offers a required attribute that lets you specify whether your application requires and cannot function without the declared feature, or whether it prefers to have the feature but can function without it. Because feature support can vary across Android devices, the element serves an important role in letting an application describe the device-variable features that it uses.
Here, "external entity" usually means an app distribution channel, like the Play Store.
Is my understanding right?
Yes. One role of <uses-feature> is to indicate that some feature is not required, where a permission would imply that it is required.
Because i find it funny there is feature android.hardware.wifi .. what phone, mobile device doesn't have a wifi?
There is no requirement that Android devices support WiFi. For example, Android is used in vehicles, from cars to the Boeing 787 Dreamliner, and those environments may not offer WiFi.
You are correct in your understanding. The uses tag is mainly for filtering on the play store. Which means that users who may have a device that doesn't support a required feature that your app depends on, will not see your app in the listings.
As an aside. There are plenty of Android devices which don't feature a wireless chipset. I've been working with Android based Barcode scanners that don't have Wifi, nor GPS services. It's always best to handle things in code, depending on what the device is capable of.
Hope this helps.

Application is not working with wifi on android device

I am making an application in android which integrates twitter and facebook logins and save the logged user info. It is working fine in device with GPRS. But when I am trying to run the application with wifi it gives exception as below.
For Twitter: "Server error"
For Facebook: "DialogError"
please give me some hint to solve this problem.
use permission
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
I think u off ur WIFI in phone.

Android official bluetooth chat sample cannot connect

Has anybody meet such a problem? when using the bluetooth chat sample , it
says could not connected! i have tested the sample with two android2.1 mobile phone!
anyone who meet such a problem can share the solution?
the code just go to the socket.accept then it block,could not go !
Do U add permissions to AndroidManifest.xml ?
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />

Categories

Resources