How can i add these statements in app.json? - expo

I want to allow HTTP traffic in my app using the expo-managed workflow. What is the way to add these statements to the app.json file?
<manifest ...>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:usesCleartextTraffic="true"
android:networkSecurityConfig="#xml/network_security_config"
...>
<activity android:name=".MainActivity" ...>
...
</activity>
</application>
</manifest>

Related

Unix domain Socket not working on Android 9 (API level 28)

I have two android apllication ( client and a server ) that are connected by Unix domain socket on the native level (C++/JNI). Both were built using target API level 27 and were working fine for years. Recently I have upgraded them to API level 28 and now I the client can't connect to the server the connect() function return -1 . If I just change all build dependencies to use lower API levels (<=27) it connects correctly. From what i've read on the behavior changes for Android 9 I don't really know what could cause such a thing. Here is the log that i get from logcat.
com.company.client I/TSOCKET: TSocket::open()
com.company.client I/TSOCKET: TSocket::unix_open()
com.company.client I/TSOCKET: TSocket::openConnection()
com.company.client I/TSOCKET: TSocket::setLinger()
com.company.client I/TSOCKET: TSocket::setNoDelay()
com.company.client I/TSOCKET: TSocket::structlen = static_cast<socklen_t>(sizeof(address)) 110
com.company.client I/TSOCKET: TSocket::openConnection() connect() return -1
I know that API 28 requests run time permissions, and both the service and the app request and get write, read, and internet runtime permissions.
My client manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.company.client"
android:versionCode="2"
android:versionName="5.1.0">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_label"
tools:replace="android:label"
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true"
android:networkSecurityConfig="#xml/network_security_config"
android:theme="#style/AppTheme" >
<activity
android:name="com.company.client.clientActivity"
android:label="#string/app_label"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.zxing.client.android.CaptureActivity"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="landscape"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="com.google.zxing.client.android.SCAN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="ar.com.daidalos.afiledialog.FileChooserActivity" />
</application>
</manifest>
my server manifest
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.server"
android:versionCode="2"
android:versionName="5.1.0">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
<uses-permission android:name="android.permission.ACCESS_ALL_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.PERSISTENT_ACTIVITY" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.FILTER_EVENTS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<permission android:name="android.hardware.usb.host" />
<uses-feature
android:name="android.hardware.usb.host"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_label"
android:requestLegacyExternalStorage="true"
android:theme="#style/AppTheme">
<receiver android:name="com.company.server.autostart">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<activity
android:name="com.company.server.MainActivity"
android:label="#string/app_label"
android:launchMode="singleInstance"
android:theme="#android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".Service"
android:enabled="true"
android:exported="true"
android:isolatedProcess="false">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
<action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="#xml/devices_filter" />
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"
android:resource="#xml/devices_filter" />
</service>
</application> </manifest>
how can I make the local socket connection to work?

Android Actionbar icons appearing to be blurred

My Actionbar icons are appearing to be blurred in the emulator as well as ma phone.
I have tried to increase the dimensions of the icons,the size of icons is increasing but its again showing the same blurred icons.
I have also tried to add the in manifest still thr is no effect.
I also tried to change my min sdk to 14 but still thr is no change in the icons.
Please help i am stucked in this from last one month..
MainActivity
#Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
openBottomSheet();
return true;
}
else if(id==R.id.action_stories_settings){
Settings();
}
return super.onOptionsItemSelected(item);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="com.appsfreax.humansofindia.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.appsfreax.humansofindia.permission.C2D_MESSAGE" />
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<application
android:name=".app.ParseApplication"
android:largeHeap="true"
android:allowBackup="true"
android:icon="#drawable/humans_india_icon"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".activity.MainActivity"
android:label="#string/app_name"
android:clearTaskOnLaunch="true"
android:theme="#style/CustomActionBarTheme"
>
</activity>
<activity
android:name=".activity.Submit_story"
android:label="#string/title_activity_sumit_story" >
</activity>
<activity
android:name=".activity.Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activity.All_stories"
android:label="#string/app_name" >
</activity>
<activity
android:name=".activity.Errorview"
android:label="#string/app_name" >
</activity>
<service android:name="com.parse.PushService" />
<receiver
android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver
android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<!--
IMPORTANT: If you change the package name of this sample app,
change "com.parse.tutorials.pushnotifications" in the lines
below to match the new package name.
-->
<category android:name="com.appsfreax.humansofindia" />
</intent-filter>
</receiver>
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.appsfreax.humansofindia"
minSdkVersion 13
targetSdkVersion 20
versionCode 102
versionName "1.0.2"
}
Menu.xml
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item
android:id="#+id/action_settings"
android:icon="#drawable/t"
android:orderInCategory="100"
android:title="Botttom menu"
app:showAsAction="always"
/>
<item
android:id="#+id/action_stories_settings"
android:title="#string/action_settings"
android:icon="#drawable/settings_icon"
android:orderInCategory="200"
app:showAsAction="always" />
Blurred Image
https://drive.google.com/file/d/0B_2xbmgzcrhmcHk2QnR4V3lsWWs/view?usp=sharing
It seems problem with the icon size you're using. I believe you're using small icon which is being stretched and looks blurry.
Try using atleast 70px*70px png canvas with 48x48 icon inside (IMO). Refer the image below.
if you want bigger/lesser icon size you can change the icon size accordingly.
hope this helps :)

Google Map showing Blank Screen

I am currently developing an android app that needs google maps. All of the instructions and procedures are done and working perfectly but when I run it now it displays only blankscreen and zoom.
This is my main activity.java:
package com.example.lrt;
import com.google.android.gms.maps.SupportMapFragment;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class Googlemapko extends FragmentActivity{
#Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.googlemapko);
SupportMapFragment fragment = new SupportMapFragment();
getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit();
}
}
This is my Layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.lrt.Googlemapko" >
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/button1"
class="com.google.android.gms.maps.SupportMapFragment"/>
</RelativeLayout>
MY Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.lrt"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<permission android:name="com.example.lrt.permission.MAPS_RECEIVE"
android:protectionLevel="signature"></permission>
<uses-permission android:name="com.example.lrt.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyB61vojABlTFrB9QTv9kXWKXPknI0iot_o" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="com.example.lrt.Googlemapko"
android:label="#string/app_name"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Do you try to run signed app or not?
If not, you just will not be able to connect to maps api, so it will show you blank fragnent.

Glass XE17.1 - Custom voice commands broken?

I have followed the exact steps from the official documentation, but I still cannot get my app to start using the custom voice command. The steps are followed are:
1 Add new string resource for custom voice command in strings.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Hello World!</string>
<string name="glass_voice_trigger">start example</string>
</resources>
2 Create a new XML file for voice startup definition:
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="#string/glass_voice_trigger" />
3 Request proper permissions in AndroidManifest.xml:
<uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT" />
4 The manifest part looks as follows:
<service
android:name="pl.infoshare.sample.helloworld.HelloWorldService"
android:icon="#drawable/ic_lap"
android:label="#string/app_name"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/voice_trigger_start" />
</service>
Still, I am not able to start the app using the voice command. If I change to one of the predefined voice commands the app shows up on the timeline and I can start it using the voice command. Did I miss anything?
Looking through the question, I didn't see anything jump out at me as incorrect. So, I created a small sample GDK project that is launched with a custom voice command, and runs just fine on my XE17.1 device. (Bonus, it demos a low-frequency LiveCard!)
Try pulling down my sample from GitHub, and see if you can launch it with the command:
'OK Glass, start my awesome app'
Below are some of the relevant bits.
AndroidManifest.xml:
<uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#android:style/Theme.DeviceDefault">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:immersive="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<service
android:name=".LowFreqLiveCardService"
android:enabled="true"
android:exported="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name">
<intent-filter>
<action android:name=
"com.google.android.glass.action.VOICE_TRIGGER"/>
</intent-filter>
<meta-data android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/voice_trigger"/>
</service>
</application>
</manifest>
res/xml/voice_trigger.xml:
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="#string/custom_keyword" />
res/values/strings.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Low Freq Demo</string>
<string name="heart_rate">Heart Rate</string>
<string name="custom_keyword">start my awesome app</string>
</resources>
Here's a link to the voice command documentation, it still provides instructions on using custom voice commands. And, from my testing, they still do work.
Custom voice commands require, since a couple of versions ago, the aproval from google. You can send a request for that aproval from the glass developer site.
Review this.

Selectively setting voice input constraints on submenu items

As I found on a Glass Developers page, it is possible to set voice constraints to disable your voice trigger if certain features are unavailable. I thought this would work for the disambiguation submenu as well, so I tried putting a constraint on one Activity in the submenu but not the others. Instead of just disabling that one submenu item ("Choose from list"), however, this disabled the entire menu ("Make a request"). Here's my manifest and voice trigger xml resources:
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.twintitanium.glassapps.decisionmaker"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<service
android:name="com.twintitanium.glassapps.decisionmaker.DecisionMakerService"
android:enabled="true"
android:exported="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
</service>
<activity
android:name="com.twintitanium.glassapps.decisionmaker.MenuActivity"
android:enabled="true"
android:theme="#style/MenuTheme" >
</activity>
<activity
android:name="com.twintitanium.glassapps.decisionmaker.ChooseFromListActivity"
android:label="#string/choice_from_list"
android:icon="#drawable/ic_choose_from_list" >
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/make_a_request_with_network_constraint_trigger" />
</activity>
<activity
android:name="com.twintitanium.glassapps.decisionmaker.RollDieActivity"
android:label="#string/die_roll"
android:icon="#drawable/ic_roll_die" >
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/make_a_request_trigger" />
</activity>
<activity
android:name="com.twintitanium.glassapps.decisionmaker.FlipCoinActivity"
android:label="#string/coin_flip"
android:icon="#drawable/ic_flip_coin" >
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/make_a_request_trigger" />
</activity>
<activity
android:name="com.twintitanium.glassapps.decisionmaker.YesNoActivity"
android:label="#string/yes_or_no"
android:icon="#drawable/ic_yes_no" >
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/make_a_request_trigger" />
</activity>
</application>
</manifest>
As you can see, I use make_a_request_with_network_constraint_trigger for ChooseFromListActivity but make_a_request_trigger for the other Activities.
make_a_request_with_network_constraint_trigger.xml:
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="#string/glass_voice_trigger">
<constraints
network="true" />
</trigger>
make_a_request_trigger.xml:
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="#string/glass_voice_trigger" />
(Just to clarify, "#string/glass_voice_trigger" is "Make a request".)
Is there a reason that the network constraint given to one Activity disables the entire menu, even though the other Activities don't have the same constraint? Is there another way to selectively constrain one Activity and not the others?
This doesn't sound like the desired behavior. Can you please file a bug on our issue tracker so we can investigate further?