1

I am getting a weird issue while testing on multiple devices. I am currently working on a application which uses internet connection for Api calls.

Application tested on 15 different devices & in 12 devices it works perfectly fine.

Only 3 devices its not working are the One plus devices. I tried to investigate the issue & found that it has some issues regarding internet connection. So basically its not allowing to access internet connection.

Efforts :

  • I have already tried to use lots of different solutions but didn't get any proper solution.
  • All permissions settings done perfectly
  • Only it sticks on the One plus devices as per the 15 device testing scenario
  • On that all One plus devices other apps works normally without any issues

Devices I tested on :

  • One plus
  • Moto G
  • Samsung s9
  • MI Note 4, 5
  • Gionee
  • Oppo

Can anyone kindly provide some guidance for resolving this issue.

Edit :

By getting more help from the @ninja I found that it was not actually an device specific issue. But it was an issue with OS 9.0 or above.

So by adding the below Line in manifest file did trick.

<application
....
android:usesCleartextTraffic="true"
...

Thanks in advance.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Mayur Prajapati
  • 5,454
  • 7
  • 41
  • 70

3 Answers3

2

Please check if the device block your app for data usage, under Settings -> Data Usage Control and block check: https://www.quora.com/Can-I-restrict-the-data-access-to-a-particular-app-on-OnePlus-3

if so only work round is app launch check if it can access to Internet(Not just connectivity) if so ask user to allow permission with popup.

you can redirect to setting data usage with (not tested with one plus device actually)

 Intent intent = new Intent();
 intent.setComponent(new ComponentName("com.android.settings","com.android.settings.Settings$DataUsageSummaryActivity"));
 startActivity(intent);
UdayaLakmal
  • 4,035
  • 4
  • 29
  • 40
1

By getting more help from the @ninja, I found that it was not actually an device specific issue. But it was an issue with OS 9.0 or above.

So by adding the below Line in manifest file did trick.

<application
....
android:usesCleartextTraffic="true"

Hope it will help everyone.

little
  • 2,927
  • 2
  • 25
  • 36
Mayur Prajapati
  • 5,454
  • 7
  • 41
  • 70
1

If i am not wrong then that OnePlus mobile device is running on API level 28(Pie). There are so many updates in android Pie OS.

You can check that on developer site that how many changes or behavior changed in Pie. There is one update that in Pie cleartextTraffic is by default false so if you want to enable then you have to add this property in <application> tag.

You can add this one property as below.

<application
....
android:usesCleartextTraffic="true"
....>
....
</application>

For Information you can check this stack overflow question

Ninja
  • 678
  • 10
  • 26