[JAVA] Compatible with Android 10 (API 29)

Device ID permissions changed on Android 10

All device IDs will be protected by the privilege READ_PRIVILEGED_PHONE_STATE. ** This permission cannot be granted to third party apps. (Angry) **

Restricted methods

Below, official. https://developer.android.com/about/versions/10/privacy/changes?hl=ja#non-resettable-device-ids The following methods are restricted.


Build class
TelephonyManager class
How do you give READ_PRIVILEGED_PHONE_STATE authority?

Instead of the usual grants such as request permissions It is necessary to describe the permission directly in the corresponding application part of the setting file existing on the terminal. The following article was helpful. https://qiita.com/hiesiea/items/6a2deb479958a3b44707#read_privileged_phone_state%E3%82%92%E3%83%9B%E3%83%AF%E3%82%A4%E3%83%88%E3%83%AA%E3%82%B9%E3%83%88%E3%81%AB%E8%BF%BD%E5%8A%A0%E3%81%99%E3%82%8B

However, this authority can be granted only Limited to pre-installed apps and apps distributed by mobile carriers.


Apps that you normally put on the Play Store I can no longer get the ID associated with the device. (Apps pre-installed on the device and You can use apps provided by mobile carriers)


It is called prohibition of direct path access by storage according to the target range, From API29, access to the terminal is being restricted more and more. (I overdo it and it is alleviated by API30 ...)



Recommended Posts

Compatible with Android 10 (API 29)
Create XML-RPC API with Wicket
Test Web API with junit
Use Bulk API with RestHighLevelClient
API creation with Rails + GraphQL
REST API testing with REST Assured
Link API with Spring + Vue.js
[MT] Specify the article category from Android with Data API
[MT] Specify the article category from Android with Data API
[Android] Visualize progress etc. with Progressbar
Import device images with Android app
Spring with Kotorin --4 REST API design
[Rails] Make pagination compatible with Ajax
Event handling with RxBus on Android
Automatic API testing with Selenium + REST-Assured
REST API test with REST Assured Part 2
Micro benchmark made with JFR API
Android O (API version 26) push notifications
Problems with android studio development series
Minimum configuration of Ruby REST-like API framework "grape" (with RSpec / Heroku compatible)
Getting Started with Doma-Criteria API Cheat Sheet
Com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found with YouTube Analytics API
Make Ruby Kurosawa with Ruby (Ruby + LINE Messaging API)
API integration from Java with Jersey Client
[Android] How to deal with dark themes
Achieve OpenSSL compatible encryption with Java / PHP
Build REST API with Apache2 + Passenger + Sinatra.
USB serial communication with Android app (usb-serial-for-android)
Find Raspberry Pi from Android with mDNS
Face recognition app with OpenCV + Android Studio
When calling API with java, javax.net.ssl.SSLHandshakeException occurs
Display API specifications with Laravel + SwaggerUI + Docker
Try using the Emotion API from Android
[Rails] Book search with Amazon PA API
I made a rock-paper-scissors app with android
24 hours struggling with Android development, Java Optional
Configure microservices with Spring Cloud (4): API Gateway