# Ionic android issue with Xiaomi3

**URL:** <https://forum.ionicframework.com/t/ionic-android-issue-with-xiaomi3/21785>\
**Category:** ionic-v1\
**Created:** [April 27, 2015, 4:00pm UTC](https://forum.ionicframework.com/t/ionic-android-issue-with-xiaomi3/21785 "2015-04-27T16:00:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xavianaxw](https://avatars.discourse-cdn.com/v4/letter/x/f9ae1b/32.png) [@xavianaxw](https://forum.ionicframework.com/u/xavianaxw)\
**Post date:** [April 27, 2015, 4:00pm UTC](https://forum.ionicframework.com/t/ionic-android-issue-with-xiaomi3/21785/1 "2015-04-27T16:00:24Z")

</div>

Greetings

Been stuck on this for awhile now and hoping someone could assist me in some way. Here’s what I have so far.

Ionic Version: 1.3.20  
Cordova Version: 5.0.0  
Xiaomi Version: 4.4.4

```
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="21" />

```

As for my codes, here is a snippet of what’s going on. I’m doing a simple http request to a PHP server(Laravel) to retrieve the version.

```
    Info.getVersion().then(
      function(data){
        var result = angular.fromJson(data);
        if( result.status )
        {
          if( version != result.version )
            $rootScope.updateApp();
        }
      },
      function(error){
        $rootScope.handleError( error );
      }
    );

```

**Note:** $rootScope.handleError shows an $ionicPopup

Currently, I’m getting a **Failed to load resource: the server responded with a status of 404 (Not Found)** when looking at Device Debugger on Google Chrome.

I also understand that the AndroidManifest.xml should have the following:

```
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

```

As I run **ionic build android** there were no issues reported by Ionic CLI

When I open the app, it just keeps giving me the 404 error and I’m suspecting it could be that I do not have connection within my app

P.S. I do have connection on the browser and other apps.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [April 27, 2015, 5:40pm UTC](https://forum.ionicframework.com/t/ionic-android-issue-with-xiaomi3/21785/2 "2015-04-27T17:40:40Z")

</div>

Sounds like an issue with the new release for cordova-android.  
Try adding the white list plugin

> **[apache/cordova-plugin-whitelist](https://github.com/apache/cordova-plugin-whitelist)**
>
> cordova-plugin-whitelist - Mirror of Apache Cordova plugin whitelist

[http://cordova.apache.org/announcements/2015/04/15/cordova-android-4.0.0.html](http://cordova.apache.org/announcements/2015/04/15/cordova-android-4.0.0.html)

---

<div class="post-metadata">

**Author:** ![xavianaxw](https://avatars.discourse-cdn.com/v4/letter/x/f9ae1b/32.png) [@xavianaxw](https://forum.ionicframework.com/u/xavianaxw)\
**Post date:** [April 27, 2015, 5:53pm UTC](https://forum.ionicframework.com/t/ionic-android-issue-with-xiaomi3/21785/3 "2015-04-27T17:53:31Z")

</div>

Hey @mrhartington

Was just about to link this thread to this github issue:

> <https://github.com/ionic-team/ionic/issues/3597>

Thanks again! Cheers

---

<div class="post-metadata">

**Author:** ![xavianaxw](https://avatars.discourse-cdn.com/v4/letter/x/f9ae1b/32.png) [@xavianaxw](https://forum.ionicframework.com/u/xavianaxw)\
**Post date:** [April 27, 2015, 6:11pm UTC](https://forum.ionicframework.com/t/ionic-android-issue-with-xiaomi3/21785/4 "2015-04-27T18:11:09Z")

</div>

Sorry to bother you again @mrhartington but I’m still unable to fix my issue.

Here’s what I’ve done so far

```
ionic plugin add https://github.com/apache/cordova-plugin-whitelist.git

```

This is then followed up by modifying my config.xml where including **allow-origin** , I’ve also included the following.

```
<allow-navigation href="http://omapp.my/*" />
<allow-intent href="*" />

```

As for my index.html, I’ve included the meta tag for **Content-Security-Policy**

```
<meta http-equiv="Content-Security-Policy" content="default-src 'self' omapp.my">

```

Lastly, I have run the following commands but to no avail.

```
ionic platform remove android
ionic platform add android
ionic build android

```

Your help is much appreciated!

Cheers

---

<div class="post-metadata">

**Author:** ![xavianaxw](https://avatars.discourse-cdn.com/v4/letter/x/f9ae1b/32.png) [@xavianaxw](https://forum.ionicframework.com/u/xavianaxw)\
**Post date:** [April 27, 2015, 6:38pm UTC](https://forum.ionicframework.com/t/ionic-android-issue-with-xiaomi3/21785/5 "2015-04-27T18:38:28Z")

</div>

I made some changes to my meta tag in index.html and came up with this instead and it’s working now!

```
<meta http-equiv="Content-Security-Policy" content="script-src 'self' https://maps.googleapis.com/ https://maps.gstatic.com/ 'unsafe-inline' 'unsafe-eval'">

```

I’m not sure if this is the right way to apply Content Security Policy but do let me know if I’m doing it wrong or there is a better way of doing it.

Thanks!
