File tree Expand file tree Collapse file tree 1 file changed +1
-23
lines changed
android/app/src/main/java/com/httpsms Expand file tree Collapse file tree 1 file changed +1
-23
lines changed Original file line number Diff line number Diff line change @@ -244,30 +244,8 @@ class MainActivity : AppCompatActivity() {
244244 notificationManager.createNotificationChannel(mChannel)
245245 }
246246
247- @SuppressLint(" HardwareIds" )
248247 private fun getPhoneNumber (context : Context ): String {
249- val telephonyManager = this .getSystemService(Context .TELEPHONY_SERVICE ) as TelephonyManager
250- if (ActivityCompat .checkSelfPermission(
251- this ,
252- Manifest .permission.READ_SMS
253- ) != PackageManager .PERMISSION_GRANTED || ActivityCompat .checkSelfPermission(
254- this ,
255- READ_PHONE_NUMBERS
256- ) != PackageManager .PERMISSION_GRANTED || ActivityCompat .checkSelfPermission(
257- this ,
258- Manifest .permission.READ_PHONE_STATE
259- ) != PackageManager .PERMISSION_GRANTED
260- ) {
261- Timber .d(" cannot get owner because permissions are not granted" )
262- return Settings .getOwnerOrDefault(this )
263- }
264-
265- if (telephonyManager.line1Number != null && telephonyManager.line1Number != " " ) {
266- Timber .d(" line 1 number fetched [${telephonyManager.line1Number} ]" )
267- Settings .setOwnerAsync(context, telephonyManager.line1Number)
268- }
269-
270- return Settings .getOwnerOrDefault(this )
248+ return Settings .getOwnerOrDefault(context)
271249 }
272250
273251 private fun requestPermissions (context : Context ) {
You can’t perform that action at this time.
0 commit comments