show VR tour in android - android

I want to show VR tour like this http://alfavr.ir/alfavr.ir/to/park.html in my Android app.
how can I do that?
I tried to display with web view because the file format is Html but did not work.

You can try with VRPanormaView which is included in the Google VR SDK. This is an example from https://developers.google.com/vr/develop/android/vrview:
<com.google.vr.sdk.widgets.pano.VrPanoramaView
android:id="#+id/pano_view"
android:layout_margin="5dip"
android:layout_width="match_parent"
android:scrollbars="#null"
android:layout_height="250dip" />
Inside the Activity, the primary method is VrPanoramaView.loadImageFromBitmap(). Call it with a standard Android Bitmap object and an optional VrPanoramaView.Options object. The latter is used to configure the format of the image. The Activity also implements a VrPanoramaEventListener which receives events when the load operation succeeds or fails.

Adding this line make It work.
webView.getSettings().setJavaScriptEnabled(true);

Related

How to get access to DJI mobile UX SDK FPVWidget?

I'm using Android UX SDK 4.13 with MAVIC_2_ENTERPRISE.
My goal is to access the FPV stream via the TextureView.
Im failing to find the id of the FPVwidget that is required by the following line:
TextureView videostreamPreviewTtView = (TextureView)findViewById(R.id.XXX);
In the UXSDK this is the activity layout:
<dji.ux.widget.FPVWidget
android:layout_width="match_parent" android:layout_height="match_parent"/>
I tried to add Id in the activity but the setSurfaceTextureListener did not invoked the onSurfaceTextureAvailable.
How can I get reference to the FPV widget?
I solved the problem by adding the id to the UX-SDK layout:
<dji.ux.widget.FPVWidget
android:id="#+id/FPVWidgetObj"
android:layout_width="match_parent"
android:layout_height="match_parent" />
With the new id I managed to gain access to the object:
TextureView videostreamPreviewTtView = (TextureView)findViewById(R.id.FPVWidgetObh);
The actual bitmap was retrieved with the following command:
Bitmap bitmap = videostreamPreviewTtView.getBitmap();

Street view is showing error message in android app

Hi Am working on google maps. i have added location in a fragment now am trying to add StreetViewPanoramaView to the fragment . But am getting Oops! something went wrong error message as shown in 2nd image
this is my code
maps_activity.xml
<Button
android:id="#+id/button_streetview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Open StreetView"
/>
<androidx.fragment.app.FragmentContainerView
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".MapsActivity" />
<com.google.android.gms.maps.StreetViewPanoramaView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/streetview"/>
This is my MapActivity.kt
button_streetview.setOnClickListener(View.OnClickListener {
var mStreetViewPanoramaView : StreetViewPanoramaView = findViewById(R.id.streetview)
mStreetViewPanoramaView.onCreate(savedInstanceState)
var streetViewPanorama: StreetViewPanoramaOptions = StreetViewPanoramaOptions()
streetViewPanorama.panningGesturesEnabled(false)
streetViewPanorama.position(address)
streetViewPanorama.userNavigationEnabled(false)
streetViewPanorama.zoomGesturesEnabled(true)
var streetViewPanoramaCamera : StreetViewPanoramaCamera = StreetViewPanoramaCamera(25F,30F,1F)
streetViewPanorama.panoramaCamera(streetViewPanoramaCamera)
mStreetViewPanoramaView = StreetViewPanoramaView(this,streetViewPanorama)
mStreetViewPanoramaView.getStreetViewPanoramaAsync(this)
})
i can successfully retrive latitude and longitude of a place by address and display it in infoWindow and add custom marker as shown in image.
But when i click openstreetview button error message is coming.
This is the StreetView
This is the logcat
As This Error message is showing Wrong API key but i have added correct Key as i can retrive and display a marker successfully. Can anyone please tell me where am doing wrong
It looks like you are getting the error described here:
If you receive an error such as Your card does not support automatic
recurring payments or General decline of the card, please select a
different form of payment.
You might encounter these errors if you are using a debit card that
requires two-factor authentication to complete an online transaction.
Two-factor authentication requires you to be in-session at the time of
the transaction. Cards that require you to be in-session are not
usable for subscriptions or similar recurring automatic transactions.
Your street view map should work without problem once you enable billing on your project. Hope this helps!

Algolia Android initial search is really slow

I recently implemented Algolia on my app successfully just like the examples.
But the initial search takes about 5 to 7 seconds and I couldn't find a way to make it faster after checking the whole library code and documentation. After the initial search, search becomes very fast.
There is nothing unusual in my implementation but maybe you can see something that I don't. The following code is from the activity where I initialize Algolia:
Searcher searcher = new Searcher(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY, ALGOLIA_INDEX_NAME);
searcher.setQuery(new Query("word").setExactOnSingleWordQuery(Query.ExactOnSingleWordQuery.ATTRIBUTE));
searcher.addNumericRefinement(new NumericRefinement("CountryId", NumericRefinement.OPERATOR_EQ, 1));
InstantSearch helper = new InstantSearch(this, searcher);
helper.setSearchOnEmptyString(false);
helper.search();
And this is the related xml layout:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp"
android:paddingRight="10dp"
android:paddingLeft="1dp"
android:paddingTop="6dp">
<com.algolia.instantsearch.ui.views.SearchBox
android:id="#+id/searchBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:queryHint="#string/search_text_hint"
algolia:searchIcon="#drawable/icn_search_big"
algolia:closeIcon="#drawable/icn_clear_filled_big"
android:queryBackground="#drawable/sarch_query_shape"
android:background="#drawable/search_shape"
algolia:autofocus="true"
algolia:submitButtonEnabled="false" />
</FrameLayout>`
<com.algolia.instantsearch.ui.views.Hits
android:id="#+id/hits"
android:layout_width="match_parent"
android:layout_height="match_parent"
algolia:autoHideKeyboard="true"
algolia:hitsPerPage="6"
android:layout_below="#+id/searchBarParentLayout"
algolia:infiniteScroll="false"
algolia:itemLayout="#layout/search_item_algolia_row"/>
Do you have any idea what can be the issue here?
I'm glad that the issue disappeared when you switched to another wifi.
For future readers that may encounter network issues with InstantSearch Android:
First of all, build and run one of our demo applications
If you see no problem running the example application, you can try using a proxy like Charles to investigate what's happening between your app and the network
If your problem persists when running the examples, or if you are following the documentation, send an email to support#algolia.com describing the issue with a sample of your code!

Using Crosswalk in an Android Cordova Project with Embedded WebView

I have an existing Android Cordova project which uses an embedded WebView. What this means is that the Activity does not extend CordovaActivity, but instead embeds the SystemWebView and initializes within the onCreate.
The following is currently how this is being done:
Within the layout XML file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
.... other layout elements not related to Cordova....
<org.apache.cordova.engine.SystemWebView
android:id="#+id/cdvWebView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
Within the Activity's onCreate:
SystemWebView systemWebView = (SystemWebView) findViewById(R.id.cdvWebView);
CordovaWebView cdvWebView = new CordovaWebViewImpl(new SystemWebViewEngine(systemWebView));
ConfigXmlParser parser = new ConfigXmlParser();
parser.parse(this);
cdvWebView.init(this, parser.getPluginEntries(), parser.getPreferences());
Due to the bug in Lollipop versions 5.0.+ missing the "set" button, I want to implement the Crosswalk plugin into the project.
Unfortunately, all the documentation I'm finding assumes that a typical Cordova install is being used. I haven't been able to get the embedding and initialization of the XWalkWebView working correctly and keep getting a blank white screen.
Has anybody has success with a similar scenario?
I'm not sure, but this might answer your question. It seems to show implementing an XWalkWebView outside of a typical cordova project:
https://github.com/kurli/crosswalk-website/wiki/How-to-use-Crosswalk-Embedded-API-on-Android

Can't Parse Tag <![CDATA[]]> in Android Version 2.1

Let's go to the point..
I make an Android application which target is Google APIs (Platform 2.2).
I want to parse the XML File which comes from the REST API.
The XML file likes this:
<title>EARTH WIND & FIRE Live in Concert</title>
I store that output in my String variable, which I can use later and since the output is in XML, I use XML Parser class of course.
And as you can see, since the rule of XML format doesn't allow the naked character, in this case my '&' character, it will show:
<title>EARTH WIND & FIRE Live in Concert</title>
So I change that character with this method: xml.replaceAll("&", "<![CDATA[&]]>");
xml is String and I replace my & with <![CDATA[&]]> tag.
And I follow this: Android how to parse CDATA TAG?
It says that I must use dbf.setCoalescing(true);
Everything goes fine and in my TextView shows the words EARTH WIND & FIRE Live in Concert. The ampersand character (&) is shown in my emulator (Platform 2.2).
But, when I try it in the device (Platform 2.1), it will show only EARTH WIND.
And I make the new emulator Google APIs (Platform 2.1), it shows EARTH WIND too.
Does anyone here face the same problem with me??
Is there any compatibility issue with the XML Parser or the <![CDATA[]]> tag in Android??
Thanks in advance...
In String.xml in resouces folder
<string name="my_string"><![CDATA[Please put Your long text here ]]></string>
if you want to access this string for textview:
<TextView
android:id="#+id/my_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="#string/my_string"
android:textColor="#android:color/white"
android:textSize="14sp"
android:textStyle="bold" />

Categories

Resources