How can i Integrating the AirPush Ads in my android application? - android

i want to add the AirPush Ads in my android application. I have worked read the full documentation from the http://www.airpush.com/publishers/publishers/downloadsdk/ and this pdf file download pdf for airpush sdk
Now i have two queries:
We have to give the app url either of the android market or some other when we create new app using the airpush sdk. So how can we give that url like 1st upload the app without that airpush integration and get the url of the app and then again upload with the airpush integration.
And the 2nd thing is we have to just give that app id, app key and package name in the manifest and add the jar file in lib. and rest some code which i shown below in that activity where we want to show these Ads. Am i wright ??
public class AirTestActivity extends Activity {
Airpush airpush;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// create Airpush constructor.
airpush = new Airpush(this);
airpush.startSmartWallAd(); //launch smart wall on App start
// start Dialog Ad
// airpush.startDialogAd();
// start AppWall ad
// airpush.startAppWall();
// start Landing Page
// airpush.startLandingPageAd();
airpush.startPushNotification(true);
// start icon ad.
airpush.startIconAd();
}
#Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
//use smart wall on app exit.
// airpush.startSmartWallAd();
}
return super.onKeyDown(keyCode, event);
}
}
Is it necessary to add the layout with textview and image view in the layouts like below
<ImageView
android:id="#+id/imageView"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:layout_centerHorizontal="true" >
</ImageView>
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:textAppearance="#android:style/TextAppearance.StatusBar.EventContent"
android:textSize="11dp" />
Anything else we have to do for that. Please guide me

Regarding #1 : You just need to have the package name of your application to construct market url. for example com.myapp.pack. So your app's market url will look like:
https://play.google.com/store/apps/details?id=com.myapp.pack.
In case if you change your app's package name you can edit it in edit app section of Airpush anytime.
Regarding #2 : Yes, thats the correct way to initialise Airpush.
Regarding #3 : The airpush_notify.xml is required for BannerPush ads.
Lastly the jar with your package name is the correct one to implement. Airpush360.jar is the sample jar provided with the Airtest app. IN case of any queries or confusions,please go through the implementation document provided on download sdk page or drop an email to support#airpush.com.

Related

show VR tour in 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);

Facebook Android SDK 4.5 LikeView not working

I am trying to integrate latest facebook android sdk(v 4.5) Like button. This is what I have put in my facebook_layout.xml
<com.facebook.share.widget.LikeView
android:layout_marginTop="30dp"
android:id="#+id/like_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
</com.facebook.share.widget.LikeView>
And I have a fragment where I am putting this like view onCreate method to
initialize the view
LikeView likeView = (LikeView)facebookview.findViewById(R.id.like_view);
likeView.setEnabled(true);
likeView.setLikeViewStyle(LikeView.Style.BOX_COUNT);
likeView.setObjectIdAndType(
"https://www.facebook.com/FacebookDevelopers",
LikeView.ObjectType.PAGE);
Apart from this I have also put my app id in AndroidManifest.xml as mentioned here
But I am still not able to get the like to work. When I Click on the like button it just opens up a black facebook activity and for few seconds and closes it, and there are no likes happening on this page or the same page i have created for testing.
I have resolved this issue by adding my facebook user as a Tester/Developer to my facebook android App.
Reference: https://developers.facebook.com/docs/apps/security
Note: you can set the error listener to the object of LikeView for the better understanding of what error you are getting.
likeView.setOnErrorListener(new LikeView.OnErrorListener() {
#Override
public void onError(FacebookException e) {
Log.e(TAG, e.getMessage(), e);
}
});

How to display Google Map in an Android app using Xamarin

I am designing an android app with Xamarin which will have an activity with google maps inside it, but i am struggling to display the map. It shows an empty box with no map display on it. Following is the code which i used for this practice.
My Activity
namespace teslin
{
[Activity(Label = "Map")]
public class MpActivity : Android.GoogleMaps.MapActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.MapView);
var map = FindViewById<MapView>(Resource.Id.mapv);
map.Clickable = true;
map.Controller.SetZoom(16);
map.Controller.SetCenter(new GeoPoint((int)40.8270449E6, (int)-73.9279148E6));
}}
xml lay out
<LinearLayout
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/linearLayout3"
android:layout_weight="9" />
<com.google.android.maps.MapView
android:id="#+id/mapv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:enabled="true"
android:apiKey="AIzaSyD-UMij5IO6ezjuFCNnF7tRoG3niaPbNEU" />
</LinearLayout>
It looks like you're using the obsolete/outdated Maps API v1. Google removed support for this last year.
Instead you want to use Android Maps API v2 (a part of Google Play Services). Xamarin has some documentation on Maps in Android. It can be a bit tricky to get Maps working in Android, so carefully read these docs. Specifically, you'll want to read the section on the Maps API.
There is an example on Github that shows how to use the Google Play Services Component to add Maps to your application.
For those who are looking for a thorough example, check out this video that demonstrates how to integrate Google Maps with Xamarin Android, hope this helps!

Using API for opening a chatroom - Scringo Android

I am using Scringo for implementing Group Chat within my Android App. Is there a way in which we can open a particular chatroom through code ? Right now, from the sample applications and API, I found only the below code.
Scringo.openChatRooms(MainActivity.this);
Please let me know how do I
Create a Chatroom programmatically
Open a particular Chatroom programmatically.
Right now Scringo SDK is not providing way to open a chatroom programmatically. They are having their own screens(Activity) to manage the many to many Chat functionality. They are yet to integrate the following features on their Android SDK.
1. Creating Chatrooms programmatically
2. Joining/Opening Chatrooms programmatically
Source: I got a response from their Support Team. They claim that this feature is available for their IOS sdk. I am not sure.
This code solved my problem :
MainActivity.java
public class MainActivity extends Activity {
private Scringo scringo;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
scringo = new Scringo(this);
...
findViewById(R.id.openChatRoomButton).setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View arg0) {
Scringo.openChatRooms(MainActivity.this);
}
});
...
}
main.xml
<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"
tools:context=".MainActivity" >
...
<Button
android:id="#+id/openChatRoomButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:text="#string/open_inbox_button_text" />
</RelativeLayout>

I need exact simple instructions for placing a simple hyperlink to a web site in a java android application

I am a PHP programmer who is having to do some work in the android development environment. I have 2 books on this and have tried 30 search engine topics and still have not found just a simple example of everything that you need to do to place a working hyperlink in a Java android application.
I just need a very simple but complete ingredient for doing so. I have the 2.2 android development environment with Eclipse and an emulator. I have tried the WebView control which just simply loads a web site into the window when I run the application. I need a basic hyperlink to a web site example.
I don't want anything else thrown in with it (just an application with a working hyperlink and nothing else), because I am trying to learn the different controls bit by bit along with the Java and XML code that controls them.
This is so different from PHP, ASP, etc. that it has me totally fishing for answers. Thanks;
Cullan
Android is a GUI, not a Web browser. Hence, "place a working hyperlink in a Java android application" is akin to "place a snowplow blade on a dishwasher" or "implement a Web app in COBOL". It is technically possible but probably is the incorrect solution to whatever problem it is that you really trying to solve.
So, as MatrixFrog indicates, one possibility is to use a TextView and some HTML:
TextView tv=(TextView)findViewById(R.id.whatever_you_called_it_in_your_layout);
tv.setText(Html.fromHtml("Who knows?"));
But, doing that would be unusual in a GUI environment. Most developers would use a button, or a menu choice, or something along those lines, to trigger viewing some URL.
CommonsWare, That is not what I call a detailed explanation or example of how to place a hyperlink inside an android application. It is just a small snippet of code with no further explanation. I found what works on my own and here is the Java code for it:
package com.practice.weblink;
import android.app.Activity;
import android.os.Bundle;
import android.text.util.Linkify;
import android.widget.TextView;
public class WebLink extends Activity
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView textview = (TextView) findViewById(R.id.hyperlink);
Linkify.addLinks(textview, Linkify.WEB_URLS);
}
}
The TextView has the following qualities in the main.xml file:
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="#string/hyperlink"
android:id="#+id/hyperlink"
android:autoLink="web"
>
</TextView>
The strings.xml file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">WebLink</string>
<string name="hyperlink">http://google.com</string>
</resources>
That is how you give a working example of something. Next time don't assume that people can just piece together what you are mentioning in your answer.
How about using onClick in the XML layout file?
layout.xml
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:clickable="true"
android:text="#string/market_url"
android:textColor="#00f"
android:onClick="openURL"
/>
MyActivity.java
public void openURL(View v) {
String url = ((TextView) v).getText().toString();
final Intent intent = new Intent(Intent.ACTION_VIEW).setData(Uri.parse(url));
startActivity(intent);
}

Categories

Resources