Skip to content

Commit 28ecb5a

Browse files
committed
Don't read phone number from phone
1 parent f2c57dd commit 28ecb5a

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

android/app/src/main/java/com/httpsms/MainActivity.kt

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff 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) {

0 commit comments

Comments
 (0)