Google Map showing Blank Screen - android-maps-v2

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.

Related

How can i add these statements in app.json?

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>

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 :)

How can we solve the null excaption in actionbar getactionbar function?

First I want to say that I am new in android, I have a lot of troubles with android action bar I am trying to not getting null on this line:
ActionBar actionBar = getActionBar();
I tried everything. I understand that it's returning null because the theme is not suitable to the theme of the activity. I don't know how to set a different theme to each one, but after I found a way to avoid this problem I got another problem. What I am trying to do is actionbar, and a tab bar, now I can't see the icons in the action bar, I see them in the overflow.
onCreate:
public class MainViewActivity extends Activity implements RoutesFragment.OnFragmentInteractionListener ,GroupsFragment.OnFragmentInteractionListener
,VideosFragment.OnFragmentInteractionListener,PhotosFragment.OnFragmentInteractionListener
{
private final CharSequence charSequence[] = {"Profile", "New route", "My route", "Liked route", "GroupsFragment", "Settings", "About CTwalk"};
private String charSequence2;
#Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_view);
getOverflowMenu();
ActionBar actionBar = getActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
Tab tab = actionBar.newTab()
.setText(R.string.tabs_Routes)
.setTabListener(new TabListener<RoutesFragment>(this, "Routes", RoutesFragment.class));
actionBar.addTab(tab);
tab = actionBar.newTab()
.setText(R.string.tabs_Groups)
.setTabListener(new TabListener<GroupsFragment>(
this, "GroupsFragment", GroupsFragment.class));
actionBar.addTab(tab);
tab = actionBar.newTab()
.setText(R.string.tabs_Photos)
.setTabListener(new TabListener<PhotosFragment>(
this, "PhotosFragment", PhotosFragment.class));
actionBar.addTab(tab);
tab = actionBar.newTab()
.setText(R.string.tabs_Videos)
.setTabListener(new TabListener<VideosFragment>(
this, "VideosFragment", VideosFragment.class));
actionBar.addTab(tab);
}
Android manidest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ctwalkapp.ctwalk" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name">
<activity
android:name=".MainActivity"
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=".LoginActivity"
android:label="#string/title_activity_login" >
</activity>
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<activity
android:name=".MainViewActivity"
android:label="#string/title_activity_main_view"
android:parentActivityName=".LoginActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".LoginActivity" />
</activity>
</application>
</manifest>
styles.xml:
<resources>
<style name="AppTheme" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:windowActionBar">true</item>
</style>
<style name= "MyCustomTheme" parent="android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#3f51b5</item>
</style>
</resources>

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?